# Print name of tag on Label when tag goes high

**URL:** <https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816>\
**Category:** Ignition\
**Created:** [July 17, 2020, 10:16am UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816 "2020-07-17T10:16:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [July 17, 2020, 10:16am UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/1 "2020-07-17T10:16:26Z")

</div>

Hi,

I have a tag folder with a number of Bool tags. I want to create a label that is displaying the name of the tag in case any of the tags in the folder goes high. Scripting assistance would be much appreciated.

Cheers

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [July 17, 2020, 10:48am UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/2 "2020-07-17T10:48:18Z")

</div>

If the folder isn’t too big, I’d just use an expression like this

```auto
if({path/to/tag1}, "tag 1",
if({path/to/tag2}, "tag 2",
if({path/to/tag3}, "tag 3",
   "All tags low"
)))

```

It’s a bit repetitive, but it would work fine. If you want to auto-detect what tags are in the folder, you can do it by browsing the tags, but it will end up way harder as you will probably need to set up your own polling.

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [July 17, 2020, 12:31pm UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/3 "2020-07-17T12:31:06Z")

</div>

> [@Sanderd17](#):
>
> if({path/to/tag1}, "tag 1", if({path/to/tag2}, "tag 2", if({path/to/tag3}, "tag 3", "All tags low" )))

That did work although I am looking to have more than 100 tags in the folder so ideally I'm looking for a script to navigate through the folder and print the name of any tag that is high. Thanks for your reply though.

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [July 17, 2020, 12:39pm UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/4 "2020-07-17T12:39:34Z")

</div>

As I do want to display a number of different tags on the same label, in case they go high the script above only worked when I named 1 tag. Carrying on with the rest that looks like the script below gives me error.

if({[default]Device1/AS-i/I1\_Fault}=1, “I1\_Fault”,  
if({[default]Device1/AS-i/I2\_Fault}=1, “I2\_Fault”,  
if({[default]Device1/AS-i/O1\_Fault}=1, “O1\_Fault”,  
if({[default]Device1/AS-i/O2\_Fault}=1, “O2\_Fault”,  
“All tags low”  
)))

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 17, 2020, 12:42pm UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/5 "2020-07-17T12:42:19Z")

</div>

Scripting to browse and then check status of many tags like this will be a performance disaster in scripting. I recommend using a client tag change event script, listing all of the tags in the folder. Use a top-level object in a script module to maintain a list (or a `set`) of the tags that are true, adding and removing values as events are triggered. The end of the event script would deposit the base name or names of true tags into a string client tag for the label to use.

The key reason for this approach is that the tags will be subscribed, and changes delivered efficiently, instead of a script having to poll them all on an interval.

---

<div class="post-metadata">

**Author:** ![alexm](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@alexm](https://forum.inductiveautomation.com/u/alexm)\
**Post date:** [July 17, 2020, 2:01pm UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/7 "2020-07-17T14:01:44Z")

</div>

Would it be possible to contact you via email for a more detailed description?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 17, 2020, 5:34pm UTC](https://forum.inductiveautomation.com/t/print-name-of-tag-on-label-when-tag-goes-high/36816/8 "2020-07-17T17:34:23Z")

</div>

> [@alexm](#):
>
> contact you via email

Well, my policy is to only provide free advice/code/designs in public, and only as I have quiet time available.

But if you want to engage my professionals services, a PM to get started would be fine... (:
