How can I use a custom property in the filter alarm script?
Im passing a machine number through a custom proportie and want to show only alarms that matches the alarm associated data (machine number)
On the filterAlarm script on the Alarm Journal we do the following:
group = alarmEvent.get("AlarmGroup")
filter = self.parent.getComponent('FilterChk').selected
groupName = self.parent.getComponent('ddPrefix').selectedStringValue
if filter==True:
if groupName!='':
if group == groupName:
return True
else:
return False
else:
return True
The filter line is a checkbox we have on the window asking if the user wants to filter.
The groupName line is a drop down list containing the AlarmGroups
alarmGroup is a custom setting on the alarm tag that we set to the area of the plant.
This helped me find what I’m looking for support.inductiveautomation.com … /ignition/
According to the manual, I should use
... the Root Container
event.source.parent.MyProperty
My custom property is called “MachineNum” so my code should look like this, but this is not working
[code] Group = alarmEvent.get(“Group”)
Machine = alarmEvent.get(“Machine”)
MachineNum=event.source.parent.MachineNum
if Machine==MachineNum:# or Group==“Blender” :
return True
ERROR [StatusChart-DesignerExecEngine-thread-3] Error invoking extension method.
Traceback (most recent call last):
File "<extension-method filterAlarm>", line 16, in filterAlarm
NameError: global name 'event' is not defined
how can i specify custom property to filter alarm?
I have 20 Tank which required same alarms to each one of this and i was passing parameter as my “TankNumber” and my custom property name is “Tank” to pass parameter through this so i used below code for this. But i m not fulfilling my requirement
group = alarmEvent.get("Tank")
TankNumber = alarmEvent.get("Tank")
TankNumber= self.parent.TankNumber
TankNumber=int(TankNumber)
if TankNumber == True:
if TankNumber!='TankNumber':
if TankNumber == TankNumber:
return True
else:
return False
else:
return True