Custom properties in filter Alarm Script

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)

[code]Group = alarmEvent.get(“Group”)
Machinenum= (?)
if Group==“Blender” & Machine==Machinenum
return True

return False[/code]

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 :thumb_left:
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 :scratch:

[code] Group = alarmEvent.get(“Group”)
Machine = alarmEvent.get(“Machine”)
MachineNum=event.source.parent.MachineNum
if Machine==MachineNum:# or Group==“Blender” :
return True

return  False[/code]

Throw some print lines in there to debug it.

[code] Group = alarmEvent.get(“Group”)
Machine = alarmEvent.get(“Machine”)
MachineNum=event.source.parent.MachineNum
print Group
print Machine
print MachineNum
if Machine==MachineNum:# or Group==“Blender” :
return True

return False[/code]

That will tell you what is being returned and what to look for next.

The error is related to

MachineNum=event.source.parent.MachineNum

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

:question:

Change it to self.parent.
Look back up at my example code I posted earlier.

great, that worked!!! :prayer:

[code] Group = alarmEvent.get(“Group”)
Machine = alarmEvent.get(“Machine”)
MachineNum = self.parent.MachineNum
MachineNum=str(MachineNum)
if MachineNum == Machine:
return True

return  False[/code]

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