Change a label text based on multiple dynamic tag

Hello everyone,

I’m making a perspective view of an analog signal which shows the value, the engineering units and the status of the 4 alarm level (High, HighHigh, Low, LowLow).

In this view I created a Parameter called TagPath where I set the path of the UDT “Analog_Signal” that contains all the tag mentioned before and many others.

My problem is that I have a single label where I want to show the text of the 4 alarm with the format “HH,H,L,LL” based on which alarm is active (with priorities on the HH and LL) but I can’t find a way to check all the 4 bits (which are created dynamically since the use the parameters “TagPath”).

Any idea if it’s possible to do without using 4 different labels on top of each other?

I would suggest that you would set up alarms on the analog signal that correspond to the setpoints for the H, HH, L,LL levels on the value. Then you can make a simple tag/Alarms/HighestActivePriority binding that changes the status based on that highest priority alarm.

1 Like

All the things you mentioned are new to me, I’ll try them and let you know if it works.

Thank you so much

1 Like

What David suggests is probably the best way to do it.

But for future reference, the way you could do it that you were trying to do it:
Create custom props on your view: 1 for each alarm level. Place an indirect tag binding on each of them that yields a Boolean. Then in your label, create an expression binding that references those custom props instead of the tags themselves.

I would make an expression tag in the UDT using binEnc(L,H,LL,HH), then make your indirect binding to that and use > expressions to set the color based on the highest priority (i.e. if HH (and any other) is set it’ll be >= 8, LL >= 4, H >= 2, L >= 1)

However, why not just make 4 separate labels and highlight/mark the ones that are active? Then it’s clear which one(s) are active and no need for the extra tag.

Ewww!

Don't make such things in your UDTs just for UI use. Those belong in your UI.

If it needs to be on a single label showing all active alarms with commas between then you'll likely need to bind to the UDT and use a script transform. You can do it with an expression transform which is more efficient computationally but it's sorta ugly if you want it with comma's between each tbh. Generally people recommend avoiding using script transforms for loading speed so it's likely better to only show the highest priority rather than all of them.

active_alarms = []
if value.HH: active_alarms.append("HH")
if value.H:  active_alarms.append("H")
if value.L:  active_alarms.append("L")
if value.LL: active_alarms.append("LL")
return ", ".join(active_alarms)

However if separate labels are sufficient and you aren't running 8.3 for the newer alarm metrics then just make one for each alarm and toggle the display property based on the alarm being active. If you do it in a flex container it'll auto arrange them to still look clean.

If you are running 8.3 and you can consider only showing the highest priority alarm with the assumption it's on the operator to open the faceplate and see the rest then as David said binding to that is the most efficient.
Tag/Alarm Metrics.highestActivePriority

I managed to make it work with this method so I’ll stick to this for now.

Thanks you.

Thank you for your suggestion, I’m actually running Ignition 8.3 and my aim was to show only the highest alarm, so I’ll use the function mentioned before