Function Binding - Alarm Status

I am using Vision 8.0.12 and I was hoping to modify/alter the Alarm Status Table. I looked around and saw it suggested to use a Table with the Function Binding of Alarm Status. It yields 6 columns (EventId, Source, DisplayPath, EventTime, State, Priority). Is there a way to further modify this? There are a lot more columns possible in the Alarm Status Table, but it’s not possible to change the names of the columns.

The next step up from the function binding is manually issuing system.alarm.queryStatus() - it has the same six columns in the basic dataset returned, but the AlarmQueryResults object can also be examined to pull in more information.

How do I use that? I found it in the javadoc, but honestly I have no idea what I’m looking at with the javadoc. Is this the right path?

state = ["ActiveUnacked", "ActiveAcked", "ClearUnacked", "ClearAcked"]
results = system.alarm.queryStatus(state = state)
table = event.source.parent.getComponent("Table 1")
test = []
for item in results:
	IDstr = str(item.getId())
	test.append(results.getEvent(IDstr))
print test

I am not sure how to get that in the Table, I end up getting errors.

Should be something like this. Disclaimer; untested:

from collections import defaultdict

state = ["ActiveUnacked", "ActiveAcked", "ClearUnacked", "ClearAcked"]
results = system.alarm.queryStatus(state = state)
table = event.source.parent.getComponent("Table 1")

ds = results.getDataset() # gets the same columns that the function binding returns

data = defaultdict(list)
for alarmEvent in results:
	data["notes"].append(alarmEvent.getNotes())
	data["name"].append(alarmEvent.getName())

for column, values in data.items():
	ds = system.dataset.addColumn(ds, ds.columnCount, values, column, basestring)

table.data = ds
1 Like