I have a perspective project where the customer wants to toggle which alarms show on an alarm status table based on the state of a series of toggle switches. Ideally, I would like to update the table filter using a binding or a binding + transform or maybe a message handler.
I have alarm groups configured using custom Associated Alarm Data.
I’m trying to figure out how to filter the results of a Perspective Alarm Status Table using Associated Alarm Data. I’m familiar with filtering alarms by group using system.alarm.queryStatus but I don’t think there’s a way to bind the results of that method to the Alarm Status Table.
I was thinking maybe I need to use a Message handler or binding but I don’t know how to reference the Associated data on an alarm from the Alarm Status Table.
I’m pretty sure there’s a way to do this but I haven’t found it yet.
Can someone help me with this?
In the extension function of the alarm status table you can filter on associated data.
try:
group = alarmEvent.get("AlarmGroup")
except:
group = ''
groupName = self.parent.getComponent('ddFilter').selectedLabel #Grab the groupname from the drowpdown list
table = self.getComponent(0).getComponent(0).getComponent(1).getComponent(0).getComponent(0).getComponent(0)
if groupName[3:]!='_Alarms':
if groupName!='' and groupName != None:
if group == groupName:
table.sortColumn(6,True,False)
return True
else:
table.sortColumn(6,True,False)
return False
else:
return True
We do some additional things like sort the table and check for other properties but the above code should get you going in the right direction. Our Associated Data is named AlarmGroup
I think you’re looking at the Vision module Alarm Status Table. I might be missing something but I have not been able to locate any extension functions on the Perspective Alarm Status Table.
I feel like there should be a way to do this with a Message Handler or a Binding Transform but I haven’t found an example.
I know this is old, but I'm just commenting here in case anyone else is searching...
The Extension Functions are in the Configure Scripts... link in the context menu of the Alarm Status Table component.
For example, if you were to add a view parameter named "alarmGroup", and then use the following script, you should get what you need.
def filterAlarm(self, alarmEvent):
group = alarmEvent.get("Group")
if group == self.view.params.alarmGroup:
return True
return True
There's an entry regarding Alarm Grouping in the docs that outlines it.
1 Like