How to setup the Alarm Journal to Filter on Associated Data
Once associated data is added to an alarm, you can easily filter for specific alarms in the Alarm Journal Table component. Typically, the Alarm Journal Table shows you the complete history of all alarms within a specific time period using the Date Range component.
In this example, a 'WriteableFloat1' Tag was used and added to an alarm. You can see that two alarms were configured for 'WriteableFloat1,' but only one has associated data. Associated data was added to the High Alarm called ‘Group’ and was given a static value of ‘Group A.’ You can filter on what is shown in the alarm list based on the associated data. You can search for all the Group A’s or whatever associated data that was added to your alarm.
Once your associated data is configured in your alarm, the next thing you need to do is setup your script to filter for all the alarms in your history that have the associated data named 'Group' with a value of ‘Group A’. Instead of using the properties in the Property Editor, go to the Scripting area and use an Extension Function.
- Right click on your Alarm Journal Table component and select Scripting. The Component Scripting window will appear.
- Under the Extension Functions folder, click 'filterAlarm.'
- Check Enabled and enter the following code at the bottom of the 'filterAlarm' script.
group = alarmEvent.get("Group") if group == "Group A": return True return False
What the ‘filterAlarm’ script is doing, is for every alarm matching ‘Group A,’ it will return ‘True,’ and show the alarm in the table. If the associated data does not match ‘Group A’, it will return ‘False,’ and the alarm will not show up in the table.
Scripting allows you to use the 'filterAlarm' function for associated data. This script is only going to show you the alarms matching the associated data. You can add other filters as well depending on your requirements.
This example shows the updated ‘filterAlarm’ script. Press OK.
By default, the script is not going to automatically use your new filter until the data is updated. This happens automatically when a window is opened, but to trigger the associated data filter immediately, change the Start Date or End Date. The easiest way to change the start and end dates is by moving the Date Range slider if you have one already bound, as shown in the example below.
Click Preview Mode, and move the Date Range slider to initiate the associated data filter.
Now, the Alarm Journal Table will show only alarms for 'Group A.' So it is very easy to filter on associated data. The associated data is outside the folder structure and outside the Display Path. It allows you to filter any way you want so you can look at alarms in a particular area of the plant or for a certain set of alarms.