I’ve created a simple alarm history report which just has a table showing the following fields:
- Event time
- Display path
- Event State
- Name
- Event Value?
here's my script
dS = system.date.addSeconds(system.date.now(),-120)
dE = system.date.now()
alarms = system.alarm.queryJournal(startDate = dS , endDate = dE)
alarmProperties = ['EventTime',
'Label',
'EventValue',
'DisplayPath',
'EventState',
'Name',
'Priority',
'State',
'isActive'
]
header = ['EventTime',
'Label',
'EventValue',
'DisplayPath',
'EventState',
'alarmType',
'Priority',
'State',
'isActive',
]
data = [ ]
for alarm in alarms:
bufferData = [ ]
for prop in alarmProperties:
propertyAlarm = alarm.get(prop)
if prop == 'EventValue' and 'bool' in str(type(propertyAlarm)):
propertyAlarm = float(propertyAlarm)
bufferData.append(propertyAlarm)
if bufferData[-1] != False and str(bufferData[2]).split('/')[0] == window.getRootContainer().selectedStringValue:
data.append(bufferData)
datasetFinal = system.dataset.toDataSet(header, data)
I want this last value to be the one which caused the alarm trigger, however it does not show the event value for which the alarm was cleared. Is there any way to achieve this?
I'm using alarm query journal as my data source.