Need to show embedded view based on the table data in DB

Hi all.,
I have page, that need to add machine details. machine details are recorded in DB. I need to configure the embeeded view based on one condition,
Condition 1: if table has data it should respective table data in table component[That has separate view]
Condition 2: if table is empty, it should another view as called "No data to show"
Attached the picture that should show in embedded view when table is empty!
kindly help!

  • Create a view. I will assume you are using a flex view.
  • Add a Table component.
  • Set POSITION.grow : 1.
  • Create a binding on PROPS.data to get the information to be displayed.
  • Add a Label component.
  • Set POSITION.grow : 1.
  • Set PROPS.text : No data to show.

Create a binding on the Table's POSITION:display.

Table display on data

Figure 1. Table.

Create a similar binding on the Label's POSITION.display but set the expression to as follows:

Label display if data

Figure 2. Label.

Now the table should display if there is data. The label should display if there is no data.

2 Likes

Thank you for your reply. I will try now!

There was an error in my Figure 2. I fixed it.

2 Likes

executed the same using ignition embedding view.
Bind the property of "props.path" of embedding view as shown in the figure.
Note: I am using query tag to get the data for table component.

Be careful with your comparison ....value} > '0'. You are comparing a query tag result (dataset or JSON) with a string '0'. This might not work in the way you expect in all cases.

If you are looking for a non-empty string then it should be ....value} > '' but whether either solution is correct depends on the data type / structure.

2 Likes

Thank you.Noted