Sign in to follow this  
jbotas

Copy Alarm To Variable

Recommended Posts

I'm trying to do a script that list alarms and creates a table with the active alarms.

The problem is that the listall function only return the names as strings.

I need to do a lot of "executes" to check for example if the alarms are fired.

This is really slow and the script takes alot of time to check all the alarms.

If i have about 150 alarms and 50 of them fires it takes 2 to 3 seconds to run the script

 

I tried but I can't copy an alarm to a variable like this

 

private Alm = execute("Alarm."+Almname)

private AlmFired = Almname.Fired

 

Is there a way to acess the database of alarms without using the execute?

Maybe a list function that returns the alarms but with the parameters and variables acessed in a "while" or "for"

 

ex:

 

private AlmList = Alarm.List()

private iter = 0

while(iter < NumRows(AlmList))

  if(AlmList[iter].Fired)

        //code here

  endif

  iter++

endwhile

 

As attachment i'll put my teste project. The script is ALARM_DISPLAY_MANAGER and the display of the alarms is in page ALARMES and TEMPLATE_BANNER

 

Testes.ctl

Share this post


Link to post
Share on other sites

You would be better off creating your own table of alarm states and using the Fire, Ack, Reset events of each alarm to update that table.

Share this post


Link to post
Share on other sites

In my opinion by event is not a good solution.

We can't import and export alarms with the events.

So if i have 100 alarms i have to copy the code of the 3 events in every alarm. To much work and prone to human error.

And if later i create another alarm i can forget about the events and the alarm won't go in the table.

 

I'll post in the new Features Request about this functions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this