Alarming Functions

Here are a couple things I would like to do and want to ask if they are possible before I go down the rabbit hole.

  1. I would love to be able to click on an alarm in the summary and take the user to the page where that alarm originates from. Would there be any way to do this? It would require a Go To Alarm button or something, but can I query what is selected in the alarm table?

  2. Acknowledge an alarm from a button on a screen that isn’t part of the alarm summary. Is there scripts for this?

  3. Reply to e-mail notifications if an alarm has been acknowledged.

Thanks

I would second No1

This is function Citect has and its likely that I will be asked for in future by at least one client I can think of, perhaps an expression box can be added to the alarm set up that can be activated when a “Help” or go to link is clicked or activated on the additional info dropdown on the summary page.

Chris

#1) Yes. I do this on 7.5 already. I do not see why it would not work in 7.6 thou I have not tried it yet.

I added the following Custom Properties on Alarm Table:
oldrow
Row -> linked to Selected Row on Alarm Table.

On the alarm table, mouseClicked add the following code:

#Get the custom properties.
oldrow = event.source.oldrow
newrow = event.source.Row

#Check to see a row is selected and this is the second click.
if newrow == -1 or oldrow <> newrow:
	event.source.oldrow = newrow
else:
	path = event.source.data.getValueAt(newrow,"Path")
	app.Functions.tracealarm(path)

Next I added a new script under app.Functions.

def tracealarm(path):
	import system
	grf = system.tag.getTagValue(path + ".Documentation")
	system.nav.openWindow(grf)

In this you could use swapWindow, centerWindow, etc to drive the windows. Depends on how you set up your navigation.

Next on each tag that generates the alarm, you need to add the window name (plus parameters if needed) you want opened to the documentation under the Metadata tab.

#2: I have never done this. But don’t see it being too difficult.

Create a window that only has that instrument perhaps a popup.
Create a button that would acknowledge the alarm(s).
On the visibility, you could add the following code:

tag = event.source.tag
search = '%' + tag + '%'
count = system.db.runPrepQuery("SELECT COUNT(*) FROM ALERT_LOG WHERE ACK_TIMESTAMP is null and PATH like ?", [search])
event.source.visible = count

On the button event handler of your choosing, I typically use action performed:
Add the following code:

import system
# Get the varibles from the root container.
tag = event.source.tag

#Get the date, format the date, Get the user
from java.util import Date
now = Date()
dt = system.db.dateFormat(now, "yyyy-MM-dd H:mm:ss")
user = system.security.getUsername()
# Acknowledge the alarms.
system.db.runPrepUpdate("UPDATE ALERT_LOG SET ACK_TIMESTAMP = ? , ACK_USER = ? WHERE ACK_TIMESTAMP is null and PATH like ?" ,[dt,user,search])

This is pretty basic, but since I don’t know how you set up all your tags / project you should be able to adapt this.

#3: I have not looked into the new alarming features of 7.6, sorry.

Hope this helps.
Cheers,
Chris

Chris,

Thanks for the insight, but the new alarm summary table just has a selected alarms dataset and you can select multiple alarms. It is just a checkbox next to the alarm, but I think the doubleclick would work since that holds it to just one alarm after the 2nd click. I will play around with it.

I think I’ll need to look into the ack some more - they added some new scripting functions for the acknowledgement.

Still would like to know about #3.