# \[Possible BUG\] Alarm Journal Question

**URL:** <https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981>\
**Category:** Ignition\
**Created:** [July 27, 2016, 4:12pm UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981 "2016-07-27T16:12:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amarth](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarth/32/3313_2.png) [@Amarth](https://forum.inductiveautomation.com/u/Amarth)\
**Post date:** [July 27, 2016, 4:12pm UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/1 "2016-07-27T16:12:45Z")

</div>

Hello,

Is there a way to display the “Notes” property of an alarm in an “Alarm Journal” component (as it is possible in an “Alarm Status” component) ?

[EDIT] See end of thread.

---

<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:** [July 27, 2016, 6:58pm UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/2 "2016-07-27T18:58:40Z")

</div>

Notes Area Location should be the property you’re looking for? This value can be set to each of the compass directions, or to Hidden (default). Setting it to dock will display the Notes attributes within the journal component.

---

<div class="post-metadata">

**Author:** ![Amarth](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarth/32/3313_2.png) [@Amarth](https://forum.inductiveautomation.com/u/Amarth)\
**Post date:** [July 28, 2016, 9:47am UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/3 "2016-07-28T09:47:54Z")

</div>

Thank you very much for the reply.  
I wasn’t very clear but the initial need was to have the Notes displayed in a column (like it is possible for the Alarm Status) and not in a separated field. That way, all the notes are displayed without having to click on each alarm.

---

<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:** [July 28, 2016, 5:46pm UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/4 "2016-07-28T17:46:21Z")

</div>

So, this is technically possible through scripting, but when trying to get something to work for you I actually found a bug; it appears there’s a problem with the system.alarm.queryJournal function at present. I know you specifically mentioned the Alarm Journal Table component; you specifically need the output of the Alarm Journal Table, but with the Notes column added? If so, unfortunately, there’s no real way (I’m aware of) to make that happen at present. Here’s the example code I’m using to fetch the data, if you’re curious:

[code]def getAlarmJournal(journal, startdate=None, enddate=None):

```
#sanitize input; if a timerange is not specified default to 8 hours of history
if startdate is None:
	startdate = system.date.addMinutes(system.date.now(), -480)
if enddate is None:
	enddate = system.date.now()

#poll the specified journal for the specified timerange
journalresult = system.alarm.queryJournal(journalName=journal, startDate=startdate, endDate=enddate)

```

# journalresult = system.alarm.queryStatus() #this is a query of only the alarm status table; will not have as many events as the alarm journal query

```
journalds = journalresult.getDataset()

#create a list to hold note values
notes = []

#iterate through list of alarm events
for event in journalresult:
	#append the value of the event's notes field to the notes list
	notes.append(str(event.getNotes()))

#return, as a dataset, the journalresult dataset, adding a Notes column
return system.dataset.addColumn(journalds, 6, notes, 'Notes', basestring)[/code]

```

I placed this into the project script library, then called it on a regular Table, with an expression binding using the runScript expression function on the Data property. Again, though - I couldn’t actually get this to return any information from the Notes column.

---

<div class="post-metadata">

**Author:** ![Amarth](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarth/32/3313_2.png) [@Amarth](https://forum.inductiveautomation.com/u/Amarth)\
**Post date:** [July 29, 2016, 10:26am UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/5 "2016-07-29T10:26:36Z")

</div>

Thank you very much for your help.

On my side, I also encoutered the bug you mentionned. Notes coming from the getNotes() method are NULL (= None).

I’ve changed the topic label to highlight the fact that it is possibly a bug.

Regards.

---

<div class="post-metadata">

**Author:** ![ErikG](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@ErikG](https://forum.inductiveautomation.com/u/ErikG)\
**Post date:** [September 21, 2016, 7:26pm UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/6 "2016-09-21T19:26:55Z")

</div>

The queryJournal function needs to have the optional parameter includeData set to true.

`
#poll the specified journal for the specified timerange
   journalresult = system.alarm.queryJournal(journalName=journal, startDate=startdate, endDate=enddate, includeData=True)`

---

<div class="post-metadata">

**Author:** ![Amarth](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarth/32/3313_2.png) [@Amarth](https://forum.inductiveautomation.com/u/Amarth)\
**Post date:** [September 22, 2016, 7:25am UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/7 "2016-09-22T07:25:50Z")

</div>

Thank you for the reply.

I’ve added the includeData=True statement in my query but it does not change the result. The getNotes() method still returns a null value (None).  
I’m not really sure about this but I think that this statement only concerns the getXXXData() methods (getAckData, getActiveData, getClearedData)

---

<div class="post-metadata">

**Author:** ![ErikG](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@ErikG](https://forum.inductiveautomation.com/u/ErikG)\
**Post date:** [September 22, 2016, 9:31pm UTC](https://forum.inductiveautomation.com/t/possible-bug-alarm-journal-question/11981/8 "2016-09-22T21:31:05Z")

</div>

We are using 7.9 rc1. I didnt see anything in the release notes about this…

We have it working using a separate method to get the notes:

[code]  
start = self.d\_startDate  
end = self.d\_endDate  
journal = self.b\_journalName  
eventid = self.selectedEventId  
inclSystem = self.f\_includeSystemEvents

props = [(“EventId”,"=",eventid)]  
results = system.alarm.queryJournal(startDate=start, endDate=end, journalName=journal, all\_properties=props, includeData=True, includeSystem=inclSystem)

```
self.eventData = results.getDataset()

if len(results) > 0:
	almEvt = results[0]
	
	self.selectedNotes = self.getNotes()[/code]

```

And then get the notes:

[code]notes = ‘’

```
for row in range(self.alarmConfigData.rowCount):
	prop = self.alarmConfigData.getValueAt(row, "Property")
	if prop.upper() == "NOTES":
		notes = self.alarmConfigData.getValueAt(row, "Value")
		
return notes[/code]
```
