# Custom alarm status/journal viewer in Vision?

**URL:** <https://forum.inductiveautomation.com/t/custom-alarm-status-journal-viewer-in-vision/67637>\
**Category:** Ignition\
**Tags:** ignition81, sdk, 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:** 1\
**Showing post:** 2

<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(…

---

_[View the full topic](https://forum.inductiveautomation.com/t/custom-alarm-status-journal-viewer-in-vision/67637)._
