Using filterAlarm and alarmEvent

I’m trying understand how the alarmEvent.get() function works inside a filterAlarm extension.

I have a ‘line’ UDT comprised of several ‘station’ UDTs. In the station UDT I program several alarms. In order to determine which line an alarm belongs to, in each alarm I add an Associated Data property called ‘linenum’ that is configured with a UDT Parameter (this is an integer parameter passed from the parent line UDT.)

My question is: what type is being returned by alarmEvent(‘linenum’) in the code below? The if clause fails unless I cast it to string; I cannot seem to get int to work (e.g. == 3).

I have this code in an Alarm Status table (in the filterAlarm script):

def filterAlarm(self, alarmEvent): """ """ linenum = alarmEvent.get('linenum') if str(linenum) == "3": return True else: return False

From stackoverflow I found this method to get me to use ints. This helps me get past another issue I had with None type being returned on the alarmEvent (if an alarm didn’t have the ‘linenum’ defined).

alarmline = int(alarmEvent.get('linenum') or 99)

The NoneType was probably messing me up in the first place. Tricky little ba$tard.