
Anonymous user
Not applicable
2021-06-09
12:41 PM
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
2021-06-09
12:41 PM
Using an SQL Query on an Embedded List in a Group Template
Originally published on Geo SCADA Knowledge Base by Anonymous user | June 09, 2021 09:41 PM
📖 Home Back
You can easily configure an embedded list on a Mimic in a Group Template so that the Group Instance versions of the Mimic all show data that is relevant to each particular Group Instance. All you need to do is change the syntax of the SQL query so that it includes the FullName value of the Group Instance rather than the FullName of a specific Group.
The correct syntax for this is:
This instructs the embedded list to display all entries from the CDBPoint table that have a FullName value that contains the FullName value of the group that stores the points. The * sets the embedded list to show all columns, but you can set specific columns as required.
A Group Template contains a Mimic and several points. On the Mimic, an embedded list displays the name and value for each point that is stored in the Group Template. The SQL query for the embedded list is:
This ensures that the embedded list displays the FullName and CurrentValueFormatted columns from the CDBPoint table (the database table that contains all point data). Note that the ID column has also been included - the ID column provides the pick action menu features for each point, so that you can use the list to access actions and controls for the points shown in the embedded list.
The points that are to be shown in the list are defined by the
part of the query. This ensures that the list includes all those points that have FullName values that contain the FullName value of the group that stores the points. The .% means that all points that contain the FullName value of the group in their FullName will be returned.
As the SQL query references the FullName of the group that contains the points, rather than the name of a specific group, it means that Group Instance versions of the embedded lists will show data for the points that are stored in the Group Instances.
So, let's say a Group Instance is named 'Main Line' and contains a Mimic with an embedded list and three points ('Valve 1', 'Valve 2' and 'Valve 3'). The SQL query for the embedded list is inherited from the Group Template and is:
This means that the embedded list will show the FullName and CurrentValueFormatted columns from the CDBPoint table. To determine which point data is to be shown in the embedded list, ClearSCADA searches for those points that have a FullName value that contains the FullName value of the Group Instance - the embedded list will show those points that have 'Main Line' in their FullName value. As the 'Valve1', 'Valve 2' and 'Valve 3' points are all stored in the 'Main Line' Group Instance, they all contain 'Main Line' in their FullName values. The .% part of the SQL query instructs the embedded list to show all points (rather than points that have the FullName of the Group Instance in their FullName values and have a specific name).
The embedded list shows the name and current value of the points that are stored in the Group Instance.
Each Group Instance that is associated with the same Group Template will behave in the same way - its embedded list will show the data for points that are stored in that Group Instance.
Go: Home Back
You can easily configure an embedded list on a Mimic in a Group Template so that the Group Instance versions of the Mimic all show data that is relevant to each particular Group Instance. All you need to do is change the syntax of the SQL query so that it includes the FullName value of the Group Instance rather than the FullName of a specific Group.
The correct syntax for this is:
'SELECT * from CDBPoint where FullName LIKE '''+".FullName" + '.%'''
This instructs the embedded list to display all entries from the CDBPoint table that have a FullName value that contains the FullName value of the group that stores the points. The * sets the embedded list to show all columns, but you can set specific columns as required.
Example
A Group Template contains a Mimic and several points. On the Mimic, an embedded list displays the name and value for each point that is stored in the Group Template. The SQL query for the embedded list is:
'SELECT Id, FullNAME, CurrentValueFormatted from CDBPoint where FullName LIKE '''+".FullName" + '.%'''
This ensures that the embedded list displays the FullName and CurrentValueFormatted columns from the CDBPoint table (the database table that contains all point data). Note that the ID column has also been included - the ID column provides the pick action menu features for each point, so that you can use the list to access actions and controls for the points shown in the embedded list.
The points that are to be shown in the list are defined by the
where FullName LIKE '''+"FullName"+'.%'''
part of the query. This ensures that the list includes all those points that have FullName values that contain the FullName value of the group that stores the points. The .% means that all points that contain the FullName value of the group in their FullName will be returned.
As the SQL query references the FullName of the group that contains the points, rather than the name of a specific group, it means that Group Instance versions of the embedded lists will show data for the points that are stored in the Group Instances.
So, let's say a Group Instance is named 'Main Line' and contains a Mimic with an embedded list and three points ('Valve 1', 'Valve 2' and 'Valve 3'). The SQL query for the embedded list is inherited from the Group Template and is:
'SELECT Id, FullName, CurrentValueFormatted from CDBPoint where FullName LIKE '''+".FullName" + '.%'''
This means that the embedded list will show the FullName and CurrentValueFormatted columns from the CDBPoint table. To determine which point data is to be shown in the embedded list, ClearSCADA searches for those points that have a FullName value that contains the FullName value of the Group Instance - the embedded list will show those points that have 'Main Line' in their FullName value. As the 'Valve1', 'Valve 2' and 'Valve 3' points are all stored in the 'Main Line' Group Instance, they all contain 'Main Line' in their FullName values. The .% part of the SQL query instructs the embedded list to show all points (rather than points that have the FullName of the Group Instance in their FullName values and have a specific name).
The embedded list shows the name and current value of the points that are stored in the Group Instance.
Each Group Instance that is associated with the same Group Template will behave in the same way - its embedded list will show the data for points that are stored in that Group Instance.
Go: Home Back
Labels:
Author
Link copied. Please paste this link to share this article on your social media post.