Creating report from alarm data - getting user who acknowlegded alarm and when?

You need to take the UUID into account.

from com.inductiveautomation.ignition.common.alarming.config import CommonAlarmProperties 

start = '2022-06-04 00:00:00'
end   = '2022-06-06 00:00:00'

beginningOfDay = system.date.parse(start)
endOfDay       = system.date.parse(end)



allAlarmData = system.alarm.queryJournal(journalName='BypassJournal', startDate=beginningOfDay, endDate=endOfDay, includeSystem=False)

dictOut = {}

# Set key names for datapoints associated with each UUID
keys = ['active', 'cleared', 'name']

for alarmRecord in allAlarmData:
	# Get Data points
	eventTime    = alarmRecord.get(CommonAlarmProperties.EventTime)
	alarmActive  = alarmRecord.get(CommonAlarmProperties.ActiveTime)
	alarmCleared = alarmRecord.get(CommonAlarmProperties.ClearTime)
	# Note that I use displaypath instead of name. To each their own. ;)
	# alarmName   = alarmRecord.getName()
	alarmName    = alarmRecord.get(CommonAlarmProperties.DisplayPath)
	# The UUID is what ties it all together.
	uuid         = alarmRecord.id
	
	# Chech if the UUID exists. Make an entry for it if it does not.
	if uuid not in dictOut.keys():
		# Keys full of Nones.  
		dictOut[uuid] = {key:None for key in keys}
	# Set the alarm name, if it doesn't exist
	if not dictOut[uuid]['name']:
		dictOut[uuid]['name'] = alarmName	
	# Set the alarm active time, if it doesn't exist
	if alarmActive and not dictOut[uuid]['active']:
		dictOut[uuid]['active'] = alarmActive
	# Set the alarm cleared time, if it doesn't exist
	if alarmCleared and not dictOut[uuid]['cleared']:
		dictOut[uuid]['cleared'] = alarmCleared

headers = ['Alarm Occured At', 'Alarm Cleared At', 'Alarm Name']
rows = []
for values in dictOut.values():
	rows.append([values[key] for key in keys])

# Create the dataset
dataset = system.dataset.sort(system.dataset.toDataSet(headers, rows), 'Alarm Occured At')

util.printDataSet(dataset)

output from my own journal:

row | Alarm Occured At             | Alarm Cleared At             | Alarm Name                 
-----------------------------------------------------------------------------------------------
0   | Sat Jun 04 00:31:26 EDT 2022 | Sat Jun 04 01:12:09 EDT 2022 | 3427/140/pvc_tape          
1   | Sat Jun 04 05:59:54 EDT 2022 | Sat Jun 04 06:32:39 EDT 2022 | 3425/160/tension           
2   | Sat Jun 04 06:36:22 EDT 2022 | Sat Jun 04 07:05:38 EDT 2022 | 3425/160/tension           
3   | Sat Jun 04 07:00:15 EDT 2022 | Sat Jun 04 07:26:12 EDT 2022 | 3426/140/coax_tape         
4   | Sat Jun 04 07:02:29 EDT 2022 | Sat Jun 04 07:31:13 EDT 2022 | 3426/160/tension           
5   | Sat Jun 04 07:21:47 EDT 2022 | Sat Jun 04 07:31:13 EDT 2022 | 3426/160/handle_pull_effort
6   | Sat Jun 04 07:32:55 EDT 2022 | Sat Jun 04 07:38:14 EDT 2022 | 3426/160/handle_pull_effort
7   | Sat Jun 04 07:32:56 EDT 2022 | Sat Jun 04 07:38:14 EDT 2022 | 3426/160/tension           
8   | Sat Jun 04 07:42:04 EDT 2022 | Sat Jun 04 09:13:50 EDT 2022 | 3426/160/handle_pull_effort
9   | Sat Jun 04 07:42:05 EDT 2022 | Sat Jun 04 09:13:50 EDT 2022 | 3426/160/tension           
3 Likes