Description

Learn how to use expression items to perform calculations and create complex triggers.

Video recorded using: Ignition 7.7

Transcript

(open in window)

[00:00] Expression items are items in groups whose value come from expressions. This is very similar to an expression tag, except for that the item only exists in the group and it executes at the group's update rate. To create an expression item, we select it from the menu, then configure it in a way very similar to other types of items in the group. Expression items can use all of the expression functions provided by Ignition. Like other expressions, the ultimate return of value, And that value can either be used by other expression items in the group, or it can be written to the database or other tags. So for example, in our group we have multiple integer values. If we wanted to add them together, we can simply add references to them, and build the appropriate expression. We'll give the item a name, and we'll tell it to store to the database under a new column name called total. If we enable the group, we'll see the value and we'll see the value being logged just as we'd configured. Expression items can be used in many different ways. One common use, though, is to created more complicated trigger conditions. So for example, if we wanted to trigger when integer A was over 20 and integer C was under 10, we can create a new expression item that encoded that logic as an expression. So, it's like integer A greater than 20, and integer C less than 10. To use this item as a trigger, we need to make sure that it is set to run always. Doing this ensures the expression will be evaluated at the group update rate. And the value will then be made available as a trigger condition. We can select that item and select greater than 0 or in other words, the true condition of the expression. When we enable the group, we see that the trigger is currently 0 and the group is not running. If we change the values to make the condition true, the expression will go to 1 and the group will begin to execute. Using this technique, it is possible to create very complicated triggers for groups. With the capabilities of expressions in general, expression items quickly become a key component of transaction group design.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.