Description

Learn about the difference between items that run on a trigger and those that are "run always".

Video recorded using: Ignition 7.9

Transcript

(open in window)

[00:00] Expression items in a group can be set to execute in two different ways. Either they can be configured as run always, in which case they execute each time the group evaluates according to its schedule, or they can be set to triggered, in which case they only execute when the group is triggered according to the settings on the trigger tab. If a trigger is not in use, there's no difference between the two modes and all of the items execute each evaluation. But when used with the configured trigger, it gives you a great deal of flexibility and how to execute more complicated expressions. If your expression runs a complicated or performance intensive query, executing on a trigger can be a great way to reduce database impact. To illustrate the difference, we'll take a look at this example item which is simply summing together two other items in our group. Our group is set trigger on a blink tag on the true condition. When we enable the group, we see that since the item is currently set to run always it runs even though the group has not executed. If we trigger the group it will update in the database, but otherwise there's no distinction. Now the other mode of execution will be the only execute the group on the trigger. We could change the mode by editing the item and deselecting run always. Or we can simply drag the item from run always to triggered. Now if we reset our trigger condition and enable the group, we will see that the item does not execute. Now we can see that only on the trigger condition does it actually update. Again, for a example like this, where we're simply adding two values together, the distinction between run always in triggered is not that great. But if our expression item was executing a query, for example, to look up the current ID that the group should be running to, it would be beneficial to run it only on a trigger. One important consequence of using run always expression items is that they become available for use themselves as triggers. So for example, if we wanted to create a more complicated trigger that is something like execute the group only when the current second value was odd, we could come in, create a new expression item, set it to run always, and then encoder logic as an expression. Now this item becomes available for use on the trigger tab and we can select it as our trigger. Using run always expression items as triggers is an important technique for building powerful transaction groups.

You are editing this transcript.

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