Associated data using queryJournal

I'm not able to read an alarms associated data when using system.alarm.queryJournal, and the .get function. This method works for the system.alarm.queryStatus.

end = system.date.now()
start = system.date.addHours(end, -4)
alarmJournal = system.alarm.queryJournal(startDate = start, endDate = end)
print alarmJournal[1].get("Address")

Any help with how to read an alarms associated data would be appreciated.

How is the associated data defined? By default, alarm journals do not store static (not otherwise bound) data associated with the alarm... However, the "source of truth" for an alarm journal query is only the database- so if some element you rely on isn't stored in the DB, it will not be available upon retrieval.

The associated data has been added to the alarms using the ignition documentation.

https://docs.inductiveautomation.com/display/DOC81/Alarm+Associated+Data

These associated fields are available in the Perspective - Alarm Journal Table. I have also confirmed that they being recorded in the "Alarm Event Data" table of the SQL database.

Its just the .get() function that I'm not able to figure out.

I was in the same situation. The associated fields were appearing in the Alarm Journal Table and also in the Alarm_Event_Data table. To return these fields through the system.alarm.queryJournal function, I had to put the property includeData = True in the system.alarm.queryJournal and it worked for me.

1 Like

Thank you, this worked.