Since there have been no replies as of yet, I've created a dataset tag that runs this script to get the shelved alarms.
def getShelvedAlarmInfo():
'''
Get dataset of currently shevled alarms. Includes these columns:
| Shelved Path | Alarm Path | Display Path | Label | Expiration |
Args:
n/a
Returns:
dataset (dataset) : Dataset of currently shelved alarm tag data
'''
#get the list of paths for currently shelved alarms
shelvedPaths = system.alarm.getShelvedPaths()
#dataset headers
headers = ['Shelved Path', 'Alarm Path', 'Display Path', 'Label', 'Expiration']
#initialize blank data list for dataset creatoin
data = []
if len(shelvedPaths) > 0:
#initialize empty lists for paths and expirations
almPaths = []
almExp = []
for alm in shelvedPaths:
almPaths.append(str(alm.path))
almExp.append(system.date.format(alm.expiration, "yyyy-MMM-dd h:mm a" ))
#initialize empty lists for alarm paths, labels, and display paths
fullAlmPaths = []
almLabelPaths = []
almDisplayPathPaths = []
#for each path in the list of alarm paths
for almPath in almPaths:
#spit at the ':/' character
almPathParts = almPath.split(':/')
#create dict to map key:value pairs
almPartsDict = {}
for part in almPathParts:
key, value = part.split(':', 1)
almPartsDict[key] = value
#get values for provider, tag, and alarm keys
prov = almPartsDict.get('prov','')
tag = almPartsDict.get('tag','')
alarm = almPartsDict.get('alm','')
#create the full path to the alarm from the provider, tag path, and alarm name
fullAlmPath = '[' + prov + ']' + tag + '/Alarms/' + alarm
#append each to the corresponding list of properties
fullAlmPaths.append(fullAlmPath)
almLabelPaths.append(fullAlmPath+'.Label')
almDisplayPathPaths.append(fullAlmPath+'.DisplayPath')
#combine label and display path tag lists for a single read and extract the value from the qualified value
almInfo = [tag.value for tag in system.tag.readBlocking(almLabelPaths + almDisplayPathPaths)]
#for each path in the list of alarm paths
for i in range(0, len(almPaths)):
#add row to the data list for the dataset
data.append([almPaths[i], fullAlmPaths[i], almInfo[i], almInfo[i+len(almPaths)], almExp[i]])
#create and return dataset
dataset = system.dataset.toDataSet(headers, data)
return dataset
I have a button to hide/show the shelved alarm table. It also initially sorts and assigns the dataset from the tag when the table is opened.
Added a custom string property to hold the selected alarm's path
if({Root Container.Container.Shelved_Alarms.selectedRow} >= 0,
{Root Container.Container.Shelved_Alarms.data}[{Root Container.Container.Shelved_Alarms.selectedRow},'Shelved Path'], '')
And a button to unshelve the selected alarm.
Seems odd that at the very least there's no config options for the shelved alarms table. Ideally, the shelved alarms table columns would match the active alarms table.