Perspective Alarm Status Table - Scripting Functions

Hello There:

I am just wondering if there are any exposed scripting functions for Perspective’s Alarm Status Table. We would like to add a “Acknowledge All” button to the view in which our alarm status table resides on - however I am not seeing any scripting functions in the documentation. Hoping someone could point me in the right direction on where I could find these.

Many Thanks

Here’s what I came up with using these manual pages:
https://docs.inductiveautomation.com/display/DOC80/system.alarm.acknowledge
https://docs.inductiveautomation.com/display/DOC80/system.alarm.queryStatus

def runAction(self, event):
	"""
	This event is fired when the 'action' of the component occurs.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: An empty event object.
	"""
	#Alarm states to be cleared
	state = ["ActiveUnacked", "ClearUnacked"]
	#Create Dataset containing alarms in desired state
	result = system.alarm.queryStatus(state = state).getDataset()
	#Convert to python dataset
	alarmDataset = system.dataset.toPyDataSet(result)
	alarmNames = []
	#Iterate over dataset to get a list of alarm names
	for x in alarmDataset:
		alarmNames.append(x[0])
    #pass alarm name list, comment, username
	system.alarm.acknowledge(alarmNames, "Batch Ack", "Admin")

This goes in the Event Script on your button.

1 Like

Not currently, no, although those would make great feature requests on ideas.inductiveautomation.com :slight_smile:

1 Like