# Custom alarm status/journal viewer in Vision?

**URL:** <https://forum.inductiveautomation.com/t/custom-alarm-status-journal-viewer-in-vision/67637>\
**Category:** Ignition\
**Tags:** sdk, ignition81, vision\
**Created:** [December 14, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-status-journal-viewer-in-vision/67637 "2022-12-14T22:19:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Chlimoun](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@Joe\_Chlimoun](https://forum.inductiveautomation.com/u/Joe_Chlimoun)\
**Post date:** [December 14, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-status-journal-viewer-in-vision/67637/1 "2022-12-14T22:19:31Z")

</div>

I find the built-in alarming to be somewhat limiting, especially in the fixed 5-level priorities, and no way to display Associated Data as a column in the status window.

Is there a better approach than building custom alarm objects? I could theoretically replace "Priority" with Associated Data, and I could create more flexibility in sorting. I could also make a more effective alarm class mechanism using Associated Data and allow the object to dynamically examine alarms by class. Are there any drawbacks to this?

One caveat I can think of is logging... anyone analyzing logs would likely be confused by the built-in priority vs my custom priority. And I'm not sure what kind of performance hit there might be by using a custom alarm object. And I'm not even sure what hurdles I'd have to jump through to pull historical alarm data.

---

<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:** [December 15, 2022, 9:46am UTC](https://forum.inductiveautomation.com/t/custom-alarm-status-journal-viewer-in-vision/67637/2 "2022-12-15T09:46:09Z")

</div>

Personally, I probably wouldn't do this. At first, I will admit that I shared your view of the various unmalleable enum classes that comprise much of the data in the Alarm Status Table, and I found the complexity of that component to be a little off putting, but **the more I work with it, the more impressed I am**. The tool is quite comprehensive, and I can tell that a lot of high quality reasoning went into its design. It's actually quite a bit more flexible than it at first seems.

However, if you want to go down the road of creating your own, I don't believe it would be that difficult to create a generic version that's more approachable from the perspective of customization.

You can use [system.alarm.queryStatus](https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryStatus#system.alarm.queryStatus-StateValues)([...]) to pull the alarm information into a datset, and from there, you could manipulate the data in anyway you wanted prior to putting it into a table.  
**Example:**

```auto
alarms = system.alarm.queryStatus(state=[0, 1, 2]).getDataset()
headers = ["EventID", "State", "DisplayPath", "EventTime", "State", "Priority"]
data = []
for row in range(alarms.rowCount):
	eventID = alarms.getValueAt(row, "EventID")
	source = alarms.getValueAt(row, "Source")
	displayPath = alarms.getValueAt(row, "Source")
	eventTime = alarms.getValueAt(row, "EventTime")
	stateValue = alarms.getValueAt(row, "State")
	priorityValue = alarms.getValueAt(row, "Priority")
	if stateValue == 0:
		state = 'Cleared, Unacknowledged'
	elif stateValue == 1:
		state = 'Cleared, Acknowledged'
	elif stateValue == 2:
		state = 'Active, Unacknowledged'
	else:
		state = 'Active, Acknowledged'
	if priorityValue == 0:
		priority = 'Diagnostic'
	elif priorityValue == 1:
		priority = 'Low'
	elif priorityValue == 2:
		priority = 'Medium'
	elif priorityValue == 3:
		priority = 'High'
	else:
		priority = 'Critical'
	data.append([eventID, source, displayPath, eventTime, state, priority])
	alarmDataSet = system.dataset.toDataSet(headers, data)
	event.source.parent.getComponent('Power Table').data = alarmDataSet

```

The preceding script will create a dataset for a Power Table with 6 columns that has custom state and priority values

From there, you could use the various extension functions to customize the table.  
**Example:**

```auto
def configureCell([...])
	if selected:
		return {'background': self.selectionBackground}
	elif self.data.getValueAt(rowIndex, "Priority") == "Diagnostic":
		return {'background': 'gray', 'foreground':'white'}
	elif self.data.getValueAt(rowIndex, "Priority") == "Low":
		return {'background': 'blue', 'foreground':'white'}
	elif self.data.getValueAt(rowIndex, "Priority") == "Medium":
		return {'background': 'green', 'foreground':'white'}
	elif self.data.getValueAt(rowIndex, "Priority") == "High":
		return {'background': 'orange', 'foreground':'white'}
	else:
		return {'background': 'red', 'foreground':'white'}

```

The preceding code examples produces the following result:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/8/783dc033d600e6a0d4226f0427945553a4348fa8.png)

If you want to add acknowledgement and shelving capabilities or even create the ability for clients to add acknowledgement notes, you could probably embed the table into a container or a popup holder panel and add a couple of buttons for this purpose. Much of the source code that would be needed for this could be adapted from the example I posted here:

> [@Alarm Status table - sort order and ack notes](https://forum.inductiveautomation.com/t/alarm-status-table-sort-order-and-ack-notes/66821/3):
>
> I've developed a way to accomplish this, but to me, it seems quite complicated, so in the code below, I have been unusually detailed in my comments to make it easier to modify this code if needed. Here is the code for the Alarm Status Table's onAcknowledge extension function that will make notes optional when they not required by the tag: label = self.getComponent(0).getComponent(1).getComponent(0).getComponent(2)#This label is for the Notes Required Alert slideOverPane = self.getComponent(…
