Hi all
Version 7.6.3
We are currently attempting to create a table within our system which gives information and current settings of all configured alarms within the gateway, using features within the IA Labs scripting module (1.6.4) to get the attributes of the tags and using the current alarm severity to filter out non-alarm tags within the project. Here is the code we are attempting to use:
[code]system.db.runUpdateQuery(“Delete from alarms”)
tags = system.tag.browseTags(parentPath="", recursive=1)
for tag in tags:
tagDefs = system.tag.getAttribute(tag.fullPath,“AlertCurrentSeverity”)
if (tagDefs >= 0):
xID = system.db.beginTransaction()
path = tag.fullPath
name = system.tag.getAttribute(tag.fullPath,"Name")
message = system.tag.getAttribute(tag.fullPath,"AlertMessage")
displayP = system.tag.getAttribute(tag.fullPath,"AlertDisplayPath")
execEn = system.tag.getAttribute(tag.fullPath,"AlertExecEnabled")
alertMode = system.tag.getAttribute(tag.fullPath,"AlertMode")
ackMode = system.tag.getAttribute(tag.fullPath,"AlertAckMode")
print path
system.db.runUpdateQuery("INSERT INTO alarms (path, severity, name, Alert_Message, Alert_DisplayPath, Alert_ExecEnabled, Alert_Mode, Alert_AckMode) VALUES ('%s','%s','%s','%s','%s',%s, %i, %i )" % (path, tagDefs,name, message, displayP, execEn, alertMode, ackMode))
system.db.commitTransaction(TxID)
system.db.closeTransaction(TxID)
system.nav.closeWindow(‘Script_running’)[/code]
With this code we do retrieve some of the information from the tags (path,severity,name,AlertExecEnabled,AlertMode,AlertAckMode) but no results for the display path or the alert message are inserted into the database, I have tested running the .getAttribute on single tags with alarms using the script playground and am unable to get the information this way either,
We have notice that some configured alarms show a NULL or -1 property (such as “AlertCurrentSeverity”) when the alarm is not active but have the correct value when active. This has prevented us from finding all configured alarms, is there a different property we could use?
we would also like to extract the current setpoint and current notification pipeline.
We are obliged to provide a current list of configured alarms to our customer.
many thanks