[Possible BUG] Alarm Journal Question

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.

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.

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.

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.

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.

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)

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)

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]