SQL Query Expression Items
SQL Query Expression Items
Watch the videoExpression items can be SQL statements that handle select, update, insert, or delete statements from a database. More complicated queries can require you to set the query type manually. If the query is simple, Ignition automatically detects the query type. SQL query expression items can serve as triggers for the transaction group or they can only execute when the transaction group is triggered.
To trigger a transaction group with a SQL query Expression item
- In the Transaction Group workspace, create a New Expression item.
- On the Edit group tag, go to the Expression/SQL tab, and select SQL Query from the dropdown list.
- Enter a SQL query into the Expression item, and click OK. The SQL query must return a numerical value.
- Go to the Trigger tab, from the Trigger on item dropdown list, select the Expression item that has the SQL query.
- Properly configure the trigger conditions and start the transaction group.
SQL Statements in Transaction Groups
It is important to be mindful of expression items that perform SQL statements. A transaction group that executes repeatedly can also be executing multiple expression items. If these expression items are executing a SQL statement, the query count on a database can increase dramatically.