Support Forums
Counting Active alarms

I would like to use a variable that counts the number of active alarms.

GetContainerNumActive
(Alarm Manager module)
Description: Returns the number of active alarms within a hierarchy of
tags.
Returns: Numeric
Usage: Script or steady state.
Function Groups: Alarm Manager
Related to: Accumulate | GetContainerNumUnacked
Format: GetContainerNumUnacked(ContainerObj);
Parameters:
ContainerObj
Required. The container tag to query.
Comments: The alarm count is accumulated by the hierarchical accumulator
module. Alarm tags and tags with built in alarms
are designed to contribute to this accumulator automatically.
If you have written a custom tag with a built-in
alarm, you must ensure that it contributes its active alarms
to the count.
Example:
TotalNumUnacked = Code\AlarmManager\GetContainerNumActive(MyTagName);

This looks like the right function to use, but which tag is MyTagName ? I cant figure out the variable to put here.

Is it the "System Alarm DB"?

I would like to use a variable that counts the number of active alarms. ```` GetContainerNumActive (Alarm Manager module) Description: Returns the number of active alarms within a hierarchy of tags. Returns: Numeric Usage: Script or steady state. Function Groups: Alarm Manager Related to: Accumulate | GetContainerNumUnacked Format: GetContainerNumUnacked(ContainerObj); Parameters: ContainerObj Required. The container tag to query. Comments: The alarm count is accumulated by the hierarchical accumulator module. Alarm tags and tags with built in alarms are designed to contribute to this accumulator automatically. If you have written a custom tag with a built-in alarm, you must ensure that it contributes its active alarms to the count. Example: TotalNumUnacked = Code\AlarmManager\GetContainerNumActive(MyTagName); ```` This looks like the right function to use, but which tag is **MyTagName** ? I cant figure out the variable to put here. Is it the "System Alarm DB"?

It should just be the container tag name. In an expression in a calculation tag, for example -

\Code\AlarmManager\GetContainerNumActive([MyContext])

MyContext being the name of the context tag.

However, it appears not to be working or has something wrong in the documentation. I will have to pass it to development.

It should just be the container tag name. In an expression in a calculation tag, for example - \Code\AlarmManager\GetContainerNumActive([MyContext]) MyContext being the name of the context tag. However, it appears not to be working or has something wrong in the documentation. I will have to pass it to development.

Doug Spurrell

But is the container, System Alarm DB / Alarm Database or should I use the TCP/IP Port which I have all my tags with alarms as children under. I don't understant which container to use, and how it should be written exactly.

598da0be69c8f.png598da0cc36159.png

Please let me know if you find the solution.

EDIT: I got green on "System Alarm DB", but the result is invalid.

EDIT2: This is also not working:

\Code\AlarmManager\GetContainerNumUnacked("System Alarms DB") : Invalid

But this is working:

\Code\AlarmManager\GetNumUnacked("System Alarms DB") : 37
But is the container, **System Alarm DB** / Alarm Database or should I use the _TCP/IP Port_ which I have all my tags with alarms as children under. I don't understant which container to use, and how it should be written exactly. ![598da0be69c8f.png](serve/attachment&path=598da0be69c8f.png) ![598da0cc36159.png](serve/attachment&path=598da0cc36159.png) Please let me know if you find the solution. EDIT: I got green on "System Alarm DB", but the result is invalid. EDIT2: This is also not working: ```` \Code\AlarmManager\GetContainerNumUnacked("System Alarms DB") : Invalid ```` But this is working: ```` \Code\AlarmManager\GetNumUnacked("System Alarms DB") : 37 ````
edited Aug 11 '17 at 1:35 pm

Try this -

\AlarmManager\GetContainerNumActive([MyContext]\Root)

Replace MyContext with whatever your top level tag name is.

Try this - \AlarmManager\GetContainerNumActive([MyContext]\Root) Replace MyContext with whatever your top level tag name is.

Doug Spurrell

Try this -

\AlarmManager\GetContainerNumActive([MyContext]\Root)

Replace MyContext with whatever your top level tag name is.

This above gives a number that does not match unacked alarm numbers.

59a56438a9da3.png

You code gives 25, and the code I used gives:

\Code\AlarmManager\GetNumUnacked("System Alarms DB") : 30

Which is the correct amount of unacked alarms.

Anyway, this gives me a new strange fault.

In Idea Studio I see this:
59a564afd7d0e.png

If I click Show Operator View, I get this:
59a564f45943b.png

Where does the question mark come from?

>Try this - >\AlarmManager\GetContainerNumActive([MyContext]\Root) >Replace MyContext with whatever your top level tag name is. This above gives a number that does not match unacked alarm numbers. ![59a56438a9da3.png](serve/attachment&path=59a56438a9da3.png) You code gives 25, and the code I used gives: ```` \Code\AlarmManager\GetNumUnacked("System Alarms DB") : 30 ```` Which is the correct amount of unacked alarms. Anyway, this gives me a new strange fault. In Idea Studio I see this: ![59a564afd7d0e.png](serve/attachment&path=59a564afd7d0e.png) If I click Show Operator View, I get this: ![59a564f45943b.png](serve/attachment&path=59a564f45943b.png) Where does the question mark come from?
edited Aug 29 '17 at 1:59 pm

I'm not sure if this will be the case here but have you tried right clicking on the value and deselect the questionable data option?

I'm not sure if this will be the case here but have you tried right clicking on the value and deselect the [questionable data](https://www.trihedral.com/help/Content/Op_UsingVTS/Op_ToggleQuestionableData.htm) option?

Trihedral Engineering Ltd.

I'm not sure if this will be the case here but have you tried right clicking on the value and deselect the questionable data option?

Haha. OMG. Thanks!

Well, THAT was embarrassing.

Thanks mate! smile

>I'm not sure if this will be the case here but have you tried right clicking on the value and deselect the [questionable data](https://www.trihedral.com/help/Content/Op_UsingVTS/Op_ToggleQuestionableData.htm) option? Haha. OMG. Thanks! Well, THAT was embarrassing. Thanks mate! :D

They are checking two different things. One is the total unack'd alarms. One is the total that are still active. So, I would say that you have 30 unacknowledged alarms, twenty-five of which are still active with five cleared but still waiting to be acknowledged.

They are checking two different things. One is the total unack'd alarms. One is the total that are still active. So, I would say that you have 30 unacknowledged alarms, twenty-five of which are still active with five cleared but still waiting to be acknowledged.

Doug Spurrell

216
7
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft