The EventState column returned by system.alarm.queryJournal - does it represent the EventType/State or the Event State

I have created a button to download a csv of the Alarm Journal (Script at the bottom) I am not sure what does the EventState column represent:

By looking in the documentation of Alarm Journal | Ignition User Manual I think it might be the eventtype:

However, in the documentation of system.alarm.queryJournal | Ignition User Manual I see this and makes me think it might be the eventState (the same column shown by the Alarm Journal component, first picture) instead of the State:

Code, only the last 5 rows might be of importance in this case:

def runAction(self, event):
	from system.date import addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addYears, now
	
	journal_name = self.parent.parent.getChild("AlarmJournalTable").props.name
	date_range = self.parent.parent.getChild("AlarmJournalTable").props.dateRange
	source_filter = self.parent.parent.getChild("AlarmJournalTable").props.filter.conditions.source
	displaypath_filter = self.parent.parent.getChild("AlarmJournalTable").props.filter.conditions.displayPath
	mode = date_range.mode
	
	# Get DateRange and calculate start and end dates based on mode used (realtime, historical)
	if mode == "realtime":
		time_interval  = date_range['realtime']['interval']
		time_measure = date_range['realtime']['unit']
		
		if time_measure == 'seconds':
			start_date = addSeconds(now(), -time_interval)
		elif time_measure == 'minutes':
			start_date = addMinutes(now(), -time_interval)
		elif time_measure == 'hours':
			start_date = addHours(now(), -time_interval)
		elif time_measure == 'days':
			start_date = addDays(now(), -time_interval)
		elif time_measure == 'weeks':
			start_date = addWeeks(now(), -time_interval)
		elif time_measure == 'months':
			start_date = addMonths(now(), -time_interval)
		elif time_measure == 'years':
			start_date = addYears(now(), -time_interval)
		end_date = now()
	elif mode == "historical":
		start_date = date_range['historical']['startDate']
		end_date = date_range['historical']['endDate']
	
	result = system.alarm.queryJournal(startDate = start_date,
		endDate = end_date,
		journalName = journal_name, 
		source = source_filter, 
		displaypath = displaypath_filter
	)
	
	# system.alarm.queryJournal returns a list, .getDataset() converts the list into a dataset
	ds = result.getDataset()
	# To CSV and Download file
	csvData = system.dataset.toCSV(ds)
	system.perspective.download(filename="AlarmJournal.csv", data=csvData, fileType="csv")

For a journal query, the columns returned by getDataset are the following:

CommonAlarmProperties.EventId, 
CommonAlarmProperties.Source,
CommonAlarmProperties.DisplayPath, 
CommonAlarmProperties.EventTime,
CommonAlarmProperties.EventState, 
CommonAlarmProperties.Priority,
CommonAlarmProperties.IsSystemEvent

Where EventState is described in code comments as:

     * The most recent or most appropriate state transition of the event. Not the full state of the alarm event, which
     * is provided by the CATEGORY_STATE property.

Thank you for the clarification. From that code comment I interpret that the returned EventState column is the eventtype, mentioned in the Alarm Journal | Ignition User Manual:

Values are from this class; the ordinal count is top to bottom, starting from 0:

    Active,
    Clear,
    Ack,
    /**
     * This transition is used to indicate that an alarm event is no longer needed and should drop out of the system.
     **/
    Finished,
    /**
     * This transition is used to indicate that the alarm event has become "live" due to alarm being force enabled.
     * This will immediately be followed by an active or a clear transition.
     */
    Enabled,
    /**
     * This transition is used to indicate that an alarm event is no longer "live" due to alarm being force disabled.
     * This will immediately be followed by a finished transition.
     */
    Disabled,
    /**
     * This transition is used to indicate when an alarm is first shelved.
     */
    Shelved;

So, yes, lines up with the manual, but with the gaps explained.

1 Like

Thank you for your help!