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 firstname.lastname@example.org.
We are experiencing playback issues from our video hosting provider. Please check back shortly.
2:27Named Query Binding
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
Take topic challenge
SQL Query Binding – Scalar Query and Update
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.