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
SQL Query Binding
Description
The SQL Query binding is a polling binding type that will run a SQL Query against any of the database connections configured in the Gateway.
Video recorded using: Ignition 8.1
Transcript
(open in window)[00:00] In this lesson, we'll demonstrate the use of a simple SQL query binding. This is a polling binding type that runs a SQL query against any database connections configured in the ignition Gateway with it. We can bind any property to a SQL query to retrieve data from a database. So here I have an empty table and I can select its data property binding and click on the SQL query binding type to open up this query window. Now, you do need to know the SQL language in order to use this binding type. Otherwise, you can do a DB browse binding to help you visually interactively build the needed SQL query. But instead we'll use this field to enter our query. I've got a simple example query written in this text editor, which I will copy/paste into this window. So we're going to select the first name last name and email from our customers table and order it by first name in ascending A to Z order on the right side notice that we have icons to bring in any component property value or any tag value making this query potentially dynamic though we won't use those for this simple exercise beneath the query editor we can specify which database connection to use if this is left blank Ignition will use the default database connection set for this project and that property is found up here in the Project Properties under the Project menu. We'll instead set a database connection directly. So we'll specify the db_iu connection.
[01:44] Finally beneath that we can set the polling mode, which is how often we want this query to be run. We're going to look at the Relative mode in another lesson. So for now we're going to leave this set to off. Once the query is set up as desired we can press OK and see the specified data return from the database into the table. So those have been the basic steps needed to set up a simple SQL query binding to a database table.