Shelve Alarms from Perspective Alarm Status Table

Having a hard time adapting the example given in the manual for system.alarm.shelve() for use in Perspective, since it's a Vision example.

Anybody have a working script?

Any conversion would really depend on the structure of the View, as well as the structure of the data property of your table. Are you using a DataSet, or an array/list of objects? What does the structure of one of your rows look like?

My acknowledge button might give some insight into my setup.

def runAction(self, event):
	data = self.parent.parent.getChild("AlarmStatusTable").props.selection.active.data
	rowCount = len(data)
	
	if rowCount > 0 :
		uuids = []
		for r in range(0, rowCount):
			uuids.append(str(data[r].eventId))
		
		system.alarm.acknowledge(uuids, None, None)

Now that I look at this a little closer it might be easy to change this to shelve instead of acknowledge. Just need to get paths instead of eventId.

1 Like

I've got it to this point, but I need to get the path to the tag for the selected alarms. I'm not seeing the path under selection/active/data/0\

However, I found that using "source" does work, even though it doesn't appear to match the typical "path" that I'm used to seeing

def runAction(self, event):
	data = self.parent.parent.getChild("AlarmStatusTable").props.selection.active.data
	rowCount = len(data)
	
	if rowCount > 0 :
		paths = []
		for r in range(0, rowCount):
			paths.append(str(data[r].source))
		

		system.alarm.shelve(paths, timeoutMinutes = 5)
1 Like