# Associated data using queryJournal

**URL:** <https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [November 1, 2023, 5:22am UTC](https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284 "2023-11-01T05:22:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_Harvey](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@Nathan\_Harvey](https://forum.inductiveautomation.com/u/Nathan_Harvey)\
**Post date:** [November 1, 2023, 5:22am UTC](https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284/1 "2023-11-01T05:22:43Z")

</div>

I'm not able to read an alarms associated data when using system.alarm.queryJournal, and the .get function. This method works for the system.alarm.queryStatus.

```auto
end = system.date.now()
start = system.date.addHours(end, -4)
alarmJournal = system.alarm.queryJournal(startDate = start, endDate = end)
print alarmJournal[1].get("Address")

```

Any help with how to read an alarms associated data would be appreciated.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 1, 2023, 3:06pm UTC](https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284/2 "2023-11-01T15:06:23Z")

</div>

How is the associated data defined? By default, alarm journals do not store static (not otherwise bound) data associated with the alarm... However, the "source of truth" for an alarm journal query is _only_ the database- so if some element you rely on isn't stored in the DB, it will not be available upon retrieval.

---

<div class="post-metadata">

**Author:** ![Nathan\_Harvey](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@Nathan\_Harvey](https://forum.inductiveautomation.com/u/Nathan_Harvey)\
**Post date:** [November 1, 2023, 9:17pm UTC](https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284/3 "2023-11-01T21:17:02Z")

</div>

The associated data has been added to the alarms using the ignition documentation.

[https://docs.inductiveautomation.com/display/DOC81/Alarm+Associated+Data](https://docs.inductiveautomation.com/display/DOC81/Alarm+Associated+Data)

These associated fields are available in the Perspective - Alarm Journal Table. I have also confirmed that they being recorded in the "Alarm Event Data" table of the SQL database.

Its just the .get() function that I'm not able to figure out.

---

<div class="post-metadata">

**Author:** ![Giancarlo\_Goncalves](https://avatars.discourse-cdn.com/v4/letter/g/b77776/32.png) [@Giancarlo\_Goncalves](https://forum.inductiveautomation.com/u/Giancarlo_Goncalves)\
**Post date:** [November 13, 2023, 6:26pm UTC](https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284/4 "2023-11-13T18:26:05Z")

</div>

I was in the same situation. The associated fields were appearing in the Alarm Journal Table and also in the Alarm\_Event\_Data table. To return these fields through the system.alarm.queryJournal function, I had to put the property includeData = True in the system.alarm.queryJournal and it worked for me.

---

<div class="post-metadata">

**Author:** ![Nathan\_Harvey](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@Nathan\_Harvey](https://forum.inductiveautomation.com/u/Nathan_Harvey)\
**Post date:** [November 14, 2023, 1:41am UTC](https://forum.inductiveautomation.com/t/associated-data-using-queryjournal/81284/5 "2023-11-14T01:41:57Z")

</div>

Thank you, this worked.
