Query journal alarm, no millisecond, sorting issue

I query historical alarm from the journal with system.alarm.queryJournal.
In my case data are stored in MYSQL.

if the alarm is active and cleared in the same second when I sort my result with event time, the chronological order can be wrong because the event timetamp has no millisecond.

The alarm journal table seem to have an incremental id which could be perhaps used to give the chronological order of event but this id is not returned by the system.alarm.queryJournal result ???

system.alarm.queryJournal. return a list of event, but is there a sort order ?

Since mysql 5.6+, DATAETIME(3) enable to store datetime with milliseconds. It will be usefull to update alarm journal creating script for support of millisecond.

1 Like

Heh, I knew I dodged a lot of bullets over the past twelve years by choosing PostgreSQL. I just didn’t know about all of them (probably still don’t).

@KathyApplebaum,
It would be usefull that the system.alarm.queryJournal return the id (AutoIncremental PK of the alarm_events table) for sorting the data according the insert order, if a datetime with millisecond is not possible.
(getId return the eventid).

system.alarm.queryJournal Returns :
List - A list of matching AlarmEvent objects. AlarmEvent objects can be examined with getAckData, getActiveData, getClearedData, getCount, getDisplayPath, getDisplayPathOrSource, getId, getLastEventState, getName, getNotes, getOrDefault, getOrElse, getPriority, getProperties, getRawValueMap, getSource, getState, getValues, isAcked, isCleared, isExtended, isInherited, and isShelved.

I think they’re reworking some of the alarm journal stuff in Ignition 8? If so, hopefully something like that would get in. I’m not on that team, so I have no idea.

1 Like