Alarm Journal CSV export

Hi to All,

I want to export a csv file through a component of BUTTON from the Alarm Journal, I did it using this script:
dataset = event.source.parent.getComponent(‘Alarm Journal’).getAlarms()
file = system.date.now() **
path = system.dataset.exportCSV(“data.csv”, 1, dataset)
if path != None:
** system.net.openURL(“file://”+path)

…unfortunately, I’m not satisfied because the result (csv file) is lack of information, the event time is incomplete, I want to include the Date and there are missing columns when it exported. How can I solve this one?

Any ideas?

The right way to do it would be to issue your own system.alarm.queryJournal call to match the filters on the component, which gives you access to the same underlying data.

The more efficient, but not directly supported way, would be to get a reference to the underlying table component inside the AJT component, then extract it’s model, which will have a getAlarmAt(row) field (and getRowCount() method), which would give you full access to the reconstructed alarm event and allow you to pull whatever data you want into your constructed CSV.

1 Like

hi, i need to show the millisec in my exported csv file but only seconds is visible even though my alarm journal’s date format is yyyy-MM-dd HH:mm:ss.SSSZ

What does the data look like in a plain text editor/what does it look like if you change the date representation in Excel?