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:47Property Binding
-
2:15Property Binding – Bidirectional
-
2:19Tag Binding
-
2:17Tag Binding – Drag and Drop
-
2:19Tag Binding – Bidirectional
-
1:40Tag and Component Overlays
-
3:20Indirect Tag Binding
-
2:17Tag Historian Binding
-
3:21Expression Binding
-
1:24Expression Binding – Concat Strings
-
1:01Expression Binding – Celsius to Fahrenheit
-
2:01Expression Binding – Format Date
-
2:46Expression Binding – Date Manipulations
-
1:23Expression Binding – Bit Functions
-
2:06Expression Binding – Switch
-
1:43Expression Binding – Checking Conditions
-
2:40DB Browse Binding
-
2:05DB Browse Binding – Dynamic Filters
-
1:16SQL Query Binding
-
2:26SQL Query Binding – Polling
-
1:47SQL Query Binding – Dynamic Filters
-
1:55SQL Query Binding – Scalar Query and Fallback
-
1:47SQL Query Binding – Scalar Query and Update
-
2:24Cell Update Binding
-
2:07Function Binding
-
4:22Component Styles
Take Topic Challenge
Supplemental Videos
-
2:27Named Query Binding
LESSON
SQL Query Binding – Scalar Query and Update
Description
Learn how to bind an input component bidirectionally to a SQL query to allow data be retrieved and updated in the database.
Video recorded using: Ignition 7.7
Transcript
(open in window)[00:00] It is possible to bind an input component to a database bidirectionally, much like you bind it to a tag bidirectionally. That way, not only can we see the current value in the database, we can write a value back. So here we've a numeric text field and I what I want to do, is view and update setpoint one for recipe one in my recipes table. Since setpoint one is a floating point value. I'm going to set the number type of the numeric text field to a double. Then I'm going to bind the value double property here to a SQL query. In this binding, at the top you'd specify the select query that's going to bring the value back from the database. At the bottom, you can enable the update query to write a value back once the user changes it on the component. We're going to make use of both. So in the top one, I'll put the query in here to bring back setpoint one from my recipes table where id equals one. That's the first recipe. It's going to come from my MySQL database and I do want this query to poll, typically at a relative rate, which is the five seconds by default. We want this to always update on the screen. At the bottom, I want to enable the update query so when I change the value, I want to update the recipes table, I want to set the same column, sp1, equal to, and we don't know what the value is.
[01:11] So we're actually going to use this mark over here on the right-hand side called "this", which will be whatever the value is. It's a placeholder here. I write the same condition here, where id equals one. So now I've got both of these set up. As soon as I press okay, I'll see the value coming back from the database. So you can see down here in my query browser, sp1 for recipe one is a value of one. Now if I go into preview mode here, if I go and modify this value, like I set it to 6.43 and press enter, you will see that it's going to write it back to a database. So it's very easy to make these bindings bidirectional for databases.