# Expression into Indirect Tag Binding

**URL:** <https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584>\
**Category:** Ignition\
**Created:** [January 25, 2021, 5:24pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584 "2021-01-25T17:24:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbufarini](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mbufarini](https://forum.inductiveautomation.com/u/mbufarini)\
**Post date:** [January 25, 2021, 5:24pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/1 "2021-01-25T17:24:17Z")

</div>

Hi all,  
I have Line Component in a Template which I would use the Visible Property depending of a two tag where path changes dynamically.

Planning to use an expression like:  
Visible if {…/TTP01/…} AND {…/PPT01/…}

where TTP and PPT are between 01 to 20

I tried to use Indirect Tag Binding, but this doesn’t allow me to have more than one tag. Another solution was to use Expression Binding, but this doesn’t allow me to have dynamic reference or I don’t know how.

How to solve it?

thank you for the help!

---

<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:** [January 25, 2021, 5:34pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/2 "2021-01-25T17:34:59Z")

</div>

Use two indirect bindings with custom properties to bring in the tag values, then use those custom properties in your final expression binding.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 25, 2021, 6:28pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/3 "2021-01-25T18:28:57Z")

</div>

You can also do tag() in an expression (have as many as you want),  
[https://docs.inductiveautomation.com/display/DOC79/tag](https://docs.inductiveautomation.com/display/DOC79/tag)

But, what Phil suggested should be considered best practice.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 26, 2021, 1:32pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/4 "2021-01-26T13:32:12Z")

</div>

> [@jlandwerlen](#):
>
> You can also do tag() in an expression ( **have as many as you want** )

I can just imagine Phil's mortified face reading that 😄 like a graphic designer seeing a website done using Comic Sans

---

<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:** [January 26, 2021, 2:21pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/5 "2021-01-26T14:21:47Z")

</div>

I resisted the urge to rant. 😇

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 26, 2021, 9:02pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/6 "2021-01-26T21:02:36Z")

</div>

Well since you replied… I think I was pretty clear what best practice was. I think it’s pretty clear the OP is new, so it’s appropriate to give him multiple options. No? I forget sometimes people can’t see outside the lines, when I said add as many as you want, I assumed I was talking to a normal audience. I think it’s better to say you can add as many as you want, vs only add 3! (which isn’t true) There is nothing wrong with using tag(). I have several projects still using them and they work fine. I make it a point to use custom properties, but let’s give the new guys as much info as possible and let them make their own choice, this isn’t Facebook or Twitter! 🙄

---

<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:** [January 26, 2021, 9:22pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/7 "2021-01-26T21:22:38Z")

</div>

> [@jlandwerlen](#):
>
> There is nothing wrong with using tag().

Ah, but there is. It simply runs slower, because expressions built around it have to completely execute, even if only one little piece changes, and even if a given change wouldn't yield a change in the output. Totally aside from the (fixed?) bugs in its implementation in v8.0.

> [@Nesting Not Allowed while using Properties in a Template to turn on a Light](http://forum.inductiveautomation.com/t/nesting-not-allowed-while-using-properties-in-a-template-to-turn-on-a-light/33609/16):
>
> Yes, there is. If the items that comprise your tagpath are updated, even if yielding the same result path, the entire expression containing the tag() function will have to execute. With indirect binding, this doesn’t happen. The strings themselves have to be reconstructed every time, even if not changing, slowing down the final expression execution. There are a few cases with computed gateway tags where the tag() expression is the only good way to do indirection, and the dynamic stuff above…

Gateway expression tags are the _ **only** _ place the tag() expression function makes sense.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 27, 2021, 8:12pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/8 "2021-01-27T20:12:27Z")

</div>

> [@pturmel](#):
>
> > [@jlandwerlen](#):
> >
> > There is nothing wrong with using tag().
> 
> Ah, but there is. It simply runs slower,

What is the speed difference between a custom property and tag()? I'm not discounting what you say, but saying something is slower is subjective. For the typical user, is there going to be a problem and will they notice a difference? I sure can't.

---

<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:** [January 27, 2021, 8:35pm UTC](https://forum.inductiveautomation.com/t/expression-into-indirect-tag-binding/42584/9 "2021-01-27T20:35:07Z")

</div>

Property and expression bindings run entirely on the GUI thread. All bindings evaluate their arguments and at least _deliver_ their results on the GUI thread. As long as you don’t max out the GUI thread, you won’t notice slower expressions and everything will appear to be fine. Whether that one thread is at 5% or 95%. Once you max it out and the GUI stalls, usability takes a dive. You obviously haven’t hit this yet, so my advice is easy to dismiss.

Carry on as you wish.
