Button Background colour Dependent on alarm status?

Hi guys,
I was wondering if someone could point me in the right direction with this…
I have a button that I want to highlight ‘red’ whenever an alarm exists in my PLC code.Ofcourse I have multiple alarms as a UDT to belong to each “motor” (i.e. motor 1,2 etc). and so I cant just bind it to the 1 alarm. This Button resides in the same window/ container as the alarms status table, to make things easier if possible.

I was wondering if theres anything I can do like using the alarm status table’s properties?
However I’m not so sure on how to go about this or if there’s an easier way for this


Thank you all for the patience and advice!

Take a look at this expression function: https://docs.inductiveautomation.com/display/DOC80/isAlarmActive

You could use this using a wildcard on your tagpath to find if any alarm on the UDT was active; put it on a custom property on the button and use that property to drive the background color


1 Like

clever suggest from @jonathan.taylor. You also create a custom property with expression using OR statements between every wanted tag and set an output. Then bind the background color to itself custom property.

Thank you guys, this is a very interesting concept! Bare with me, I’m still getting the hang of coding and this is my first phyton interaction with wildcards!

with this custom property on the button…do you mean that I give it any old name like “alarms” but leave the type as the UDT that i have the motor tags on?

Also the UDT of the motors are of “Motor_Reference” (which has the OPC connections for certain properties) which have a parent data type of “Motor_Alarms” (which has the list of alarms for each motor)…will this be of any help using the wildcard…or because its merged, I would just need to add my own list of wildcards to encompass the multiple alarms?
Thank you again

This sounds great! But I have to apologies as im still getting my head around it all… I’m not entirely confident that I understand what the scripting of this expression would look like aha


Sorry for the multiple messages. just had a go myself. after trial and errors, I want to say thank you for introducing me to the wildcard concept and the is alarm active.
I went with adding the following expression to my background colour property of the component
worked like a charm!

if (isAlarmActive("[default]Motor_List/*") = 1,color(222,0,0),color(255,255,255))