You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing training@inductiveautomation.com.
Version:
LESSON LIST
Description
Learn how to filter the Alarm Status Table component on an alarm's associated data.
Video recorded using: Ignition 8.1
Resources
Transcript
(open in window)[00:00] In this video, we are going to take a look at filtering alarms on associated data. We can filter alarms in the alarm status table on the associated data that we add to our alarms by using scripting. So for example, if I go to my tags, you will see that I have test tags 1 through 10, each with an alarm that is active when the tag is true. I have an associated data on each of the alarms that I've added called group, and it has a static value of either odd or even determined by the tag number. So test tag one has a group value of odd. I can use that to filter what's shown in the alarm status table so that it shows only the odd group or only the even group. To do this, I need to right-click on the component and go into the scripting area. In the scripting area, there's an extension function we have for filtering alarms.
[01:07] This allows you to filter on anything that you want, like the associated data. I'm going to go ahead and enable this. And in this script, every alarm that would normally be displayed is going to get evaluated, and they need to return either true or false. If it's true, the alarm will be shown. And if it's false, it won't be shown. I'm going to copy my script in here. To access a property in the alarm, I can reference the alarm event argument and call .get with the name of the property I want to get the value of. You can see I'm accessing the value of my associated data property called group and assigning that value to a variable. I'm then going to say if the group is equal to odd, I'm going to return true. And at the very end, I'm going to return false. Once we hit OK, we can see that only the odd alarms are shown.
[02:05] Just like with the alarm status table, we can do the same thing with the alarm journal table. In fact, I can copy the exact same script into my journal table to filter the results in the same way. This time I will only show even alarms. Now when hitting OK, you will notice that the alarm journal table does not filter out the alarms that don't match. It's important to remember that the alarm journal table does not update on its own and will only update when the start or end date properties change. So I'm going to push my end date out a little further, and we can see then our alarms get filtered.