Next, create a script to filter for all alarms in the Alarm Status Table that have the associated data called ‘Production.’ Scripting allows you to use the 'filterAlarm' extension function specifically for filtering on associated data.
- Right click on your 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 'Production.'
Code Block language py title Extension Function - filterAlarm for 'Production'
group = alarmEvent.get("Group") if group == "Production": return True return False
Your script will look like the image below. This script will only display alarms matching the associated data for 'Production.' For every alarm matching ‘Production,’ it will return ‘True’ and show alarm results in the Alarm Status Table. If the associated data does not match ‘Production,’ it will return ‘False,’ and the Alarm Status Table will be empty. Note, when you're finished filtering on associated data, don't forget to disable your script.
Now the Alarm Status Table below shows all the alarms in the 'Production' group. Select an alarm and click the Searchicon to see all the Details about the alarm.
Note title Checking Alarm Results
- If you see alarms that do not match your associated data, check your filter settings in the Property Editor of the Alarm Status Table. 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.
- 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 from the Designer Output Console under the Tools Menu in the Designer, and from the Vision Client under Help > Diagnostics and selecting the Console tab.