# Alarm Journal Query Event Value

**URL:** <https://forum.inductiveautomation.com/t/alarm-journal-query-event-value/76362>\
**Category:** General Discussion\
**Tags:** vision, ignition81, scripting\
**Created:** [July 14, 2023, 2:10am UTC](https://forum.inductiveautomation.com/t/alarm-journal-query-event-value/76362 "2023-07-14T02:10:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Kevin\_Dagapioso](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@Dan\_Kevin\_Dagapioso](https://forum.inductiveautomation.com/u/Dan_Kevin_Dagapioso)\
**Post date:** [July 14, 2023, 2:10am UTC](https://forum.inductiveautomation.com/t/alarm-journal-query-event-value/76362/1 "2023-07-14T02:10:47Z")

</div>

I’ve created a simple alarm history report which just has a table showing the following fields:

- Event time
- Display path
- Event State
- Name
- Event Value?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/1/31eea1df36ee6e03eb2a5040d80886e1ef3e6ccf.png)

here's my script  
dS = system.date.addSeconds(system.date.now(),-120)

dE = system.date.now()

alarms = system.alarm.queryJournal(startDate = dS , endDate = dE)

alarmProperties = ['EventTime',  
'Label',  
'EventValue',  
'DisplayPath',  
'EventState',  
'Name',  
'Priority',  
'State',  
'isActive'  
]

header = ['EventTime',  
'Label',  
'EventValue',  
'DisplayPath',  
'EventState',  
'alarmType',  
'Priority',  
'State',  
'isActive',  
]

data = []

for alarm in alarms:  
bufferData = []  
for prop in alarmProperties:  
propertyAlarm = alarm.get(prop)

```
	if prop == 'EventValue' and 'bool' in str(type(propertyAlarm)):
		propertyAlarm = float(propertyAlarm)
	bufferData.append(propertyAlarm)

if bufferData[-1] != False and str(bufferData[2]).split('/')[0] == window.getRootContainer().selectedStringValue:
	data.append(bufferData)

```

datasetFinal = system.dataset.toDataSet(header, data)

I want this last value to be the one which caused the alarm trigger, however it does not show the event value for which the alarm was cleared. Is there any way to achieve this?

I'm using alarm query journal as my data source.

---

<div class="post-metadata">

**Author:** ![Dan\_Kevin\_Dagapioso](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@Dan\_Kevin\_Dagapioso](https://forum.inductiveautomation.com/u/Dan_Kevin_Dagapioso)\
**Post date:** [July 14, 2023, 7:38am UTC](https://forum.inductiveautomation.com/t/alarm-journal-query-event-value/76362/2 "2023-07-14T07:38:27Z")

</div>

can you help me with this? @justinedwards.jle

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 14, 2023, 9:02am UTC](https://forum.inductiveautomation.com/t/alarm-journal-query-event-value/76362/3 "2023-07-14T09:02:20Z")

</div>

You'll need to repaste your code inside of a preformatted block for anyone to be able to read it

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 24, 2023, 8:19am UTC](https://forum.inductiveautomation.com/t/alarm-journal-query-event-value/76362/4 "2023-07-24T08:19:01Z")

</div>

> [@nminchin](#):
>
> repaste your code inside of a preformatted block

> [@Dan\_Kevin\_Dagapioso](#):
>
> help me with this? @justinedwards.jle
> 
> ```auto
> dS = system.date.addSeconds(system.date.now(),-120)
> dE = system.date.now()
> alarms = system.alarm.queryJournal(startDate = dS , endDate = dE)
> alarmProperties = ['EventTime',
> 'Label',
> 'EventValue',
> 'DisplayPath',
> 'EventState',
> 'Name',
> 'Priority',
> 'State',
> 'isActive'
> ]
> 
> header = ['EventTime',
> 'Label',
> 'EventValue',
> 'DisplayPath',
> 'EventState',
> 'alarmType',
> 'Priority',
> 'State',
> 'isActive',
> ]
> data = []
> for alarm in alarms:
> bufferData = []
> for prop in alarmProperties:
> propertyAlarm = alarm.get(prop)
> if prop == 'EventValue' and 'bool' in str(type(propertyAlarm)):
> propertyAlarm = float(propertyAlarm)
> bufferData.append(propertyAlarm)
> if bufferData[-1] != False and str(bufferData[2]).split('/')[0] == window.getRootContainer().selectedStringValue:
> data.append(bufferData)
> datasetFinal = system.dataset.toDataSet(header, data)
> 
> ```

**What is this?**

> [@Dan\_Kevin\_Dagapioso](#):
>
> `window.getRootContainer().selectedStringValue:`
