This section discusses the triggers and actions in Flux that are used to check the value of a specific item (or items) in the database.
The information below applies to all of the database condition triggers and actions. For more specific information on a particular trigger or action, see the section for that item.
Condition Syntax for Database Condition Action and Trigger
This section describes the syntax for conditions. An SQL query returns a result as a set of zero or more rows. If the query returns zero rows, the Database Condition Action’s result will be negative, indicating that its condition was not met.
If the query returns one or more rows, only the first row is evaluated. Consequently, you must formulate your database query so that the relevant information is returned in the first row.
In that first row, there are several columns. The first column is number 1, the second column is number 2, and so on. To access column 1, use the following syntax.
In general, refer to column N as COLUMN(N), where the N argument is a number greater than or equal to one.
You can use non-negative numbers. You can use some of the usual SQL relational and boolean operators: <, <=, =, <>, >=, >, AND, OR, NOT
Some examples include:
- COLUMN(1) > 500
- COLUMN(1) < 1000 AND COLUMN(2) > 5000
- COLUMN(1) = 123
- COLUMN(1) = 50 OR COLUMN(1) = 100
- NOT COLUMN(1) = 50 OR COLUMN(1) = 100
- NOT COLUMN(2) < 250
You may not use parentheses. These operators are evaluated from right to left. For example, in the exception condition NOT COLUMN(1) = 50 OR COLUMN(1) = 100, COLUMN(1) = 100 is evaluated, then COLUMN(1) = 50 is evaluated, then the OR operator is evaluated, and finally the NOT operator is evaluated.