Hello, I’m trying to export a .CSV from the Alarm Journal. My main issue is that it is not showing the label, I thought that when you added the includeData=True it would include it didn’t so now I’m lost.
start = self.getSibling("DateTimeInput_0").props.value
end = self.getSibling("DateTimeInput").props.value
journal = system.alarm.queryJournal(journalName="GA_Journal", startDate=start, endDate=end, includeData=True).getDataset()
speadsheet = system.dataset.toCSV(journal, 1, 1)
system.perspective.download('AlarmJournal.csv', speadsheet)
Hello imt.sebastian.sanche,
The includeData parameter in fact does not include the label, it instead has the event data details when you set that parameter to true. To get the label, you will have to reference each PyAlarmEvent returned in the AlarmQueryResult and use the getLabel() method. Using that method, you can iterate through the results and copy each label to a new dataset with the returned results, and then export that final copied dataset as a .CSV. Here is an example script of iterating through the result to get the label.
end = system.date.now()
start = system.date.addHours(end, -1)
journal = system.alarm.queryJournal(journalName="Alarms", startDate=start, endDate=end, includeData=True)
print journal.getDataset()
#print journal
for j in journal:
print j.getLabel()
2 Likes