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")



