It's a common design practice to associate alarm groupings on associated data of an alarm. In this example, a ‘WriteableFloat1’ tag was used to configure a ‘High Alarm,' and associated data was added called ‘Group” with a static value called ‘Group A.’
Using a Script to Filter on Associated Data
Let's create a script to filter for all the alarms in the Alarm Status Table that have the associated data called ‘Group A.’ Scripting allows you to use the 'filterAlarm' Extension Function specifically for filtering on associated data.
- Right click on the Alarm Status Table component, and scroll down and select Scripting.
- In the Component Scripting window, under Extension Functions, select 'filterAlarm.'
- Click the Enabled checkbox.
Enter the code below into the 'filterAlarm' script. You can filter on anything you want here, but in this example, we are going to filter on 'Group A.'
Once your code is entered, it will look like this...
- This script only displays alarms matching the associated data for 'Group A.' For every alarm matching ‘Group A,’ it will return ‘True’ and show the alarm in the Alarm Status Table. If the associated data does not match ‘Group A,’ it will return ‘False,’ and the alarm will not show up in the Alarm Status Table. The example below shows the alarm including all the details about the alarm.
Note: if you are seeing alarms that do not match your associated data, check your filter settings in the Property Editor. You may need to uncheck the "Show Clear and Unacked" and "Show Clear and Acked" settings depending on what you want your operators to see.
Important Note - If an Error Filtering Script Occurs
If you have an error in this filtering script, it will return true for every alarm instance (and show all alarms) instead of displaying many errors to your users. You can find more information about the error in the Client Console under the Tools Menu.
Scripting gives you the ability to filter on associated data, but also gives you the freedom to filter on anything that you want.