Skip to main content
Version: 7.9

Expression Items

Inductive University

Expression Items

Watch the video

Expression Items are items not driven by a PLC. Instead they allow you to configure a static value, or use some other means to automatically set a value, such as a query. They are useful for executing comparisons, simple math, and looking up values from other database tables.

Much like OPC Items, Expression Items can have alarms configured, as well as numeric scaling applied directly to the item.

Scope

It is important to understand that an Expression Item only exists within its group, and can not be referenced by items in other transaction groups, Tags, and any components on a window. The only exception is to use an Expression Item to store/retrieve a value with storeVariable() and getVariable() functions. These functions store values in a space that is accessible by all Transaction Groups.

Execution Order

All Expression items will evaluate in order from top to bottom. This means referencing an Expression Item above will pull the new value, but referencing an Expression Item below will give you the value from the last group execution.

Expression Type

How an Expression Item determines its value depends heavily on its type.

  • None: Behaves similar to a Memory Tag in that the value does not automatically change.
  • Expression: Uses Ignition's Expression Language to determine the value on the Item. The expression can reference other items in the group, as well as Tags.
  • SQL Query: Utilizes a SQL query to determine the item's value. Thus, a query can execute on the item and the results can be referenced by other items in the same group.
  • New in 7.9.4
    Named Query : Named Queries can be called from an Expression item.

Run Always vs. Triggered Items

Inductive University

Run Always vs. Triggered Items

Watch the video

Expression Item can be configured in two different evaluation states:

Triggered Expression Items executes only when the transaction group is triggered. However if the group is not configured to execute on a trigger, then the item will evaluate every time the group executes (similar to how the Run-Always state works). This is the default evaluation state new Expression Items use.

Run-Always Expression Items will run before the group trigger is checked, so it always executes at the group's rate. This allows your expression to always evaluate regardless of the trigger in the group. Additionally, this state allows you to use the Expression Item as the trigger for the group. We advise that you never have a Target for a Run-Always Expression item because it always runs.

Changing the Evaluation State

Toggling between the two modes can be accomplished by dragging and dropping the Expression Item to either the Run-Always Expression Items table or the Triggered Expression Items table. Alternatively, the evaluation state can be changed by editing the Expression Item and toggling the Run-always (ignore trigger) checkbox.

SQL Queries and Expressions

Inductive University

SQL Query Expression Items

Watch the video

Expression items can use SQL statements and Ignition's Expression language to automatically determine the value of an Expression Item. This is useful in scenarios where you want to use a value from the database as the trigger for the transaction group, or aggregate several other items in the group into a single value.

Expressions and queries on an Expression Item can reference the value of other items in the group or Tags in the system by clicking on the Tag icon .

There are several Expression functions available that exist only for Transaction groups. You can find them in the Store and Forward and Variables sections of the f(x) function list.

Expression Item Properties

The following properties are available when editing an Expression Item

Property NameDescription
NameThe name of the OPC item in the group. There cannot be duplicate names within a group.
ValueThe static value of this Expression item. This will be overwritten by an Expression/SQL binding.
DatatypeThe datatype values are stored as.
PropertyWhich property of the OPC item you want to use.
  • Value - Item value
  • Quality - Quality code of the expression/SQL Query (192 = GOOD_DATA)
  • Timestamp - The last time the item value changed.
  • Name - The SQLBridge Item Name property of this Item.
ModeOptions for displaying values based on the item value.
  • Direct Value - Item value
  • Hour Meter - Record the amount of time the Item value is non-zero. This accumulation will reset to zero when the item value goes to zero. The datatype should be set to integer or float when using an Hour Meter regardless of the OPC Item type.
    • On Zero - Use a zero value to accumulate time instead of a non-zero value
    • Retentive - Retain the Hour Meter value when it is not accumulating.
    • Units - The time units to display.
  • Event Meter - Record the number or times the Item value is non-zero. The datatype should be set to integer when using an Event Meter regardless of the OPC Item type.
    • On Zero - Use a zero value to accumulate events instead of a non-zero value
Evaluation ModeRun-always (ignore Trigger) - When selected, this causes the group to evaluate at each group interval, before the trigger state is evaluated.
Write TargetTarget Type - This is the selection for what the Item will write to when the group executes.
  • None, read-only item - Do not write this value to the database.
  • Database field - Write the Item value to the specified column in the database table.
  • Other Tag - Write the Expression Item's value back to an OPC item or Tag Reference.

In addition to properties above, expression items share some common properties with tags.