# Alarm Indication based off multiple tags inside UDT

**URL:** <https://forum.inductiveautomation.com/t/alarm-indication-based-off-multiple-tags-inside-udt/9828>\
**Category:** Ignition\
**Created:** [March 23, 2015, 7:02pm UTC](https://forum.inductiveautomation.com/t/alarm-indication-based-off-multiple-tags-inside-udt/9828 "2015-03-23T19:02:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sthayer](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@sthayer](https://forum.inductiveautomation.com/u/sthayer)\
**Post date:** [March 23, 2015, 7:02pm UTC](https://forum.inductiveautomation.com/t/alarm-indication-based-off-multiple-tags-inside-udt/9828/1 "2015-03-23T19:02:57Z")

</div>

Hello,

I have a UDT with several OPC tags within, and would like to have an indicator show different colors (based off the highest priority) if any of these tags have an active alarm. The path of the UDT I'm looking for is also indircted (an integer 1-20).

I have been trying to use alarms = system.alarm.queryStatus(source = ["Process "+str(number)+"/PLC/UDTName/\*"]) but I'm not quite sure how search through the results.

The manual states:

> [@](#):
>
> AlarmEvent objects can be examined with getAckData, getActiveData, getClearedData, getCount, getDisplayPath, getDisplayPathOrSource, getId, getLastEventState, getName, getNotes, getOrDefault, getOrElse, getPriority, getProperties, getRawValueMap, getSource, getState, getValues, isAcked, isCleared, isExtended, isInherited, and isShelved

but how exactly do I "examine" the results list? I have tried iterating through alarms but I keep getting errors with incorrect syntax. Any ideas? Or is there a better way of achieving this? Thanks for the help.

---

<div class="post-metadata">

**Author:** ![wdreynolds1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wdreynolds1/32/3327_2.png) [@wdreynolds1](https://forum.inductiveautomation.com/u/wdreynolds1)\
**Post date:** [March 25, 2015, 9:01pm UTC](https://forum.inductiveautomation.com/t/alarm-indication-based-off-multiple-tags-inside-udt/9828/2 "2015-03-25T21:01:09Z")

</div>

The code I have below will return a list of basic alarm events which looks like a list of dictionaries when printed. Before you can do anything with the returned object you’ll have to iterate through the list of dictionaries to get down to the individual alarm objects. I would need to see your full code to give you a complete answer, so I’ll give you an example and see if you can’t work through it.

I created a UDT with three OPC tags that are float8. Each of those tags have one alarm configured called “Alarm”.

status = system.alarm.queryStatus(source= [’\*Alarm’]) ‘’‘returns as status all alarm objects that end in ‘Alarm’ as a list of dictionaries–each dictionary represents one alarm.’’’

for dict in status:  
print dict ‘’‘this will iterate through each dictionary in your list and print it you can then you can see what the object looks like’’’

for dict in status:  
print dict.getDisplayPathorSource() ‘’‘this will iterate through the dictionaries and return the source or path for each object’’’

Returns:

UDTs/alarmTest/sine1/Alarm  
UDTs/alarmTest/sine0/Alarm  
UDTs/alarmTest/sine1/Alarm  
UDTs/alarmTest/sine0/Alarm  
UDTs/alarmTest/sine0/Alarm  
UDTs/alarmTest/sine2/Alarm  
UDTs/alarmTest/sine0/Alarm  
UDTs/alarmTest/sine1/Alarm  
UDTs/alarmTest/sine1/Alarm  
UDTs/alarmTest/sine1/Alarm  
UDTs/alarmTest/sine0/Alarm

for dict in status:  
print dict.priority ‘’‘will print the priority level of each alarm’’’

Returns:

Critical  
Critical  
Critical  
Critical  
Critical  
Critical  
Critical  
Critical  
Critical  
Critical  
Critical

for dict in status:  
print dict.getState() ‘’‘will print the state of each alarm returned’’’

Returns:

Cleared, Unacknowledged  
Cleared, Unacknowledged  
Active, Unacknowledged  
Active, Unacknowledged  
Cleared, Unacknowledged  
Cleared, Unacknowledged  
Cleared, Unacknowledged  
Cleared, Unacknowledged  
Cleared, Unacknowledged  
Cleared, Unacknowledged  
Cleared, Unacknowledged

The full list of methods and extension functions available for the basic alarm event object are below. You can just append them to your object variable and play around.

ackData  
acked  
acknowledge  
active  
activeData  
addPropertyChangeListener  
class  
clear  
cleared  
clearedData  
contains  
count  
displayPath  
displayPathOrSource  
equals  
forEach  
get  
getAckData  
getActiveData  
getClass  
getClearedData  
getCount  
getDisplayPath  
getDisplayPathOrSource  
getId  
getLastEventState  
getName  
getNotes  
getOrDefault  
getOrElse  
getPriority  
getProperties  
getRawValueMap  
getSource  
getState  
getValues  
hashCode  
id  
isAcked  
isCleared  
isExtended  
isInherited  
isShelved  
iterator  
lastEventState  
merge  
name  
notes  
notify  
notifyAll  
of  
priority  
properties  
propertyChange  
propertyChangeListener  
rawValueMap  
remove  
removePropertyChangeListener  
set  
setDirect  
setRawValueMap  
shelved  
source  
spliterator  
state  
toString  
values  
wait

Good luck!

---

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [March 25, 2015, 9:39pm UTC](https://forum.inductiveautomation.com/t/alarm-indication-based-off-multiple-tags-inside-udt/9828/3 "2015-03-25T21:39:04Z")

</div>

I create two expression tags in my UDTs, HighestPriority and HighestUnackPriority, and then use the following expressions to capture the alarm status of all the tags that have alarms in the UDT.

HighestPriority -

`max({Tag1.AlarmHighestAckPriority},
    {Tag1.AlarmHighestUnackPriority},
    {Tag2.AlarmHighestAckPriority},
    {Tag2.AlarmHighestUnackPriority})`  
HighestUnackPriority-

`max({Tag1.AlarmHighestUnackPriority},
    {Tag2.AlarmHighestUnackPriority})`

---

<div class="post-metadata">

**Author:** ![sthayer](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@sthayer](https://forum.inductiveautomation.com/u/sthayer)\
**Post date:** [March 31, 2015, 3:39pm UTC](https://forum.inductiveautomation.com/t/alarm-indication-based-off-multiple-tags-inside-udt/9828/4 "2015-03-31T15:39:44Z")

</div>

Apologies for the late response, thanks for the replies. These definitely helped guide me in the right direction. Appreciate the help!
