You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
Version:
LESSON LIST
-
2:55Named Query Binding
-
4:04DB Browse Binding
-
3:10DB Browse Binding - Dynamic Filters
-
2:15SQL Query Binding
-
4:02SQL Query Binding - Polling
-
2:52SQL Query Binding - Dynamic Filters
-
3:45SQL Query Binding – Scalar Query and Fallback
-
3:09SQL Query Binding - Scalar Query and Update
Take Topic Challenge
LESSON
DB Browse Binding - Dynamic Filters
Description
Learn how to use the DB Browse binding to filter results from values on the screen.
Video recorded using: Ignition 8.1
Transcript
(open in window)[00:00] In this lesson, we'll demonstrate how to apply dynamic filtering to the results returned by a DB Browse Binding. To recap the prior lesson, we use DB Browse Binding to return all 40 records for first name, last name, and email into this table. The data was sorted A to Z on first name that was no filtering of the data done. We achieved this data retrieval by selecting the table clicking on its data binding and selecting the DB Browse Binding here. We selected the first name, last name, and email for display. The DB browse binding type also allows us to do filtering of data. Whereby we can add one or more key columns to search for particular records meeting some criteria. In this case, we're going to make use of this store_id column where the values are either one or two. We have customers in store one and customers in store two. We're going to make use of this data back on our Designer view. We've added a drop-down list to our view and in Preview Mode, we can see that its options are going to be store one and store two. Now, behind the scenes, of course.
[01:15] If we go to the data, we'll see that the customer ID values of one or two are what will actually use in the query. So let's return to our table's DB Browse Binding. Here we'll select the store ID and click on this little key icon. Now we see the store ID added as a key column with a specified value for filtering data. We can change the value to something else and we see that the select query is updated accordingly. But remember we still want to return the first name, last name, and email. So we will reselect those three columns and see that the query is updated accordingly where once again returning the first name, last name, and email for a specified store ID value. So finally rather than hard coding a value like this we prefer to set up a binding between this key column back to the drop-downs selected value on the screen this way the drop-down value gets used in the query making it dynamic. Note that if we wanted to we could use multiple selection criteria in our query bound to multiple screen components. So we'll click on this property binding icon, navigate down to the drop-down component. Then its Selected Value property and click OK and OK again for the DB Browse Binding. Once we do that, we see a subset of 23 records returned for store one and then if we go to Preview Mode and select store two we see the other 17 rows out of the original 40 records. So to recap this lesson we've seen how to add some dynamic filtering on a DB Browse Binding to a database table.