what is the best way to raise event on specific alerts?
I am thinking about marking specific alerts with adding common text to Alerts Note section. And monitoring Alert Summary table with lookup in Note column and binding it to Custom Property or Memory Tag.
Am I on the right track? How to prevent event from raising continuously? Because lookup will find makred Alert over and over again and raise event every time. I only need it to raise once specific Alert appear.
There are lots of ways of achieving this - it really depends what you’re wanting the event to do. I would put it either in a Client Event Script (if you want to do something graphical on the screen like popup a warning) or in a Server Event Script (if you want to do something like setting another value).
To test this, try the following:
- Add a SQLTag Memory tag with a boolean value and add a digital alarm that gets set when the value is equal to one.
- Put a button on your screen that allows you to toggle the value of this tag.
- Create a Client Tag Change Script that runs when the alarm’s AlertActive property changes (you can browse for this using the tag browser icon on the right of the dialogue).
- Write a script that pops up a dialog e.g.
system.gui.messageBox("Alarm set")Now when you run the system and set the alarm, you should see a message box appear. You will notice that it appears every time the value of the alarm changes i.e. when it changes to either 1 or 0. To alter this, change your script to something like
if newValue.value == 1: system.gui.messageBox("Alarm set")It will now only appear when the alarm is set.
Of course, doing this means the popup will appear on every client. You may have to put in other logic to make sure it only appears on certain clients, or use a Server Event Script to set another SQLTag and use that for display.
My thoughts went the same way. I made 1 expression tag which controls ActiveAndUnacked alarms through queryAlertStatus. Then I binded this tag to Tag Change script and all I need to be made is in this script.
Turned out pretty simple.