Ignition 8.0.12
I’m doing a queryStatus to get the list of all active alarms.
I need to loop trought the list of alarm objects and read the label property of each alarm.
I’m sure it’s not that hard, but can’t find any documentation example.
Thanks.
schenk
September 22, 2020, 4:36pm
2
I ran into this a while back, and this post is where I got started.
Below is the solution I ended up using for this:
from com.inductiveautomation.ignition.common.alarming.config import CommonAlarmProperties
range = event.source.parent.getComponent(‘Date Range’)
table = system.alarm.queryJournal(journalName=‘Journal’, startDate = range.startDate, endDate = range.endDate, includeSystem=True, includeData=True)
ackUserData = []
for row in table:
ackUserData.append(str(row.get(CommonAlarmProperties.AckUserName)))
ackNotes = []
for row in table:
ackNotes.appe…
This is what I ended up using, which also gets the associated data named 'Class'.
from com.inductiveautomation.ignition.common.alarming.config import CommonAlarmProperties
def alarmStatus(displaypath):
results = system.alarm.queryStatus(displaypath=displaypath)
activeDurationData = []
nameData = []
labelData = []
classData = []
for row in results:
activeDurationData.append(float(row.get(CommonAlarmProperties.ActiveDurationMS) / 1000.0))
nameData.append(str(row.get(CommonAlarmProperties.Name)))
labelData.append(str(row.get(CommonAlarmProperties.Label)))
classValue = ''
for prop in row.getActiveData().getProperties():
if str(prop) == 'Class':
classValue = str(row.get(prop))
break
classData.append(classValue)
output = results.getDataset()
output = system.dataset.addColumn(output,labelData,'Label',type(str()))
output = system.dataset.addColumn(output,activeDurationData,'ActiveDuration',type(0.0))
output = system.dataset.addColumn(output,nameData,'Name',type(str()))
output = system.dataset.addColumn(output,classData,'Class',type(str()))
return output
1 Like