# Indirect tag in an expression binding?

**URL:** <https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [June 29, 2024, 3:34am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560 "2024-06-29T03:34:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JVeldt](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@JVeldt](https://forum.inductiveautomation.com/u/JVeldt)\
**Post date:** [June 29, 2024, 3:34am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/1 "2024-06-29T03:34:36Z")

</div>

Can you use an indirect tag in an expression binding? How would I create that?

---

<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:** [June 29, 2024, 4:14am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/2 "2024-06-29T04:14:47Z")

</div>

Use a custom property to perform the indirect tag binding, then use that property in the expression.

---

<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:** [June 29, 2024, 8:22am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/3 "2024-06-29T08:22:46Z")

</div>

_don't_ use the `tag` expression function, if you do end up finding this function. This should only ever be used in expression tag expressions:

> [@Indirect Tagging in Expression](https://forum.inductiveautomation.com/t/indirect-tagging-in-expression/86771/4):
>
> The `tag()` function can't be optimized the same way indirect tag bindings can, so it's a performance pitfall.

> [@Indirect Tagging in Expression](https://forum.inductiveautomation.com/t/indirect-tagging-in-expression/86771/5):
>
> Really, if you are using the `tag()` expression function in a User Interface binding, you are screwing up. Full stop.
> 
> The **only** appropriate place to use the `tag()` expression function is to perform indirection within an **expression tag**. Nowhere else.

---

<div class="post-metadata">

**Author:** ![JVeldt](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@JVeldt](https://forum.inductiveautomation.com/u/JVeldt)\
**Post date:** [June 29, 2024, 9:17am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/4 "2024-06-29T09:17:48Z")

</div>

So I have a tag that has a tag path of [default]sitename/folder/tagname  
and I want the sitename portion of the tag path to be replaced with an indirect reference to the root containers name property. Then I want to use an expression binding with

[default]{1}/foldername/tagname && [default]{1}/foldername/tagname.quality

{1} = rootcontainer.name

This is for a visibility binding. If the tag has a true value and has good quality then the component will be visible. The tag path reference to the root container name allows me to switch between multiple sites easily by just renaming the root container.

I saw the recommendation to use a custom property to set the indirect tag but I'm not sure how to do that.

Alternatively could I just write that logical AND expression in the indirect binding section?

---

<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:** [June 29, 2024, 10:46am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/5 "2024-06-29T10:46:12Z")

</div>

In your custom prop, use an indirect tag binding to your tag. In your visible prop, use an expression binding that applies your conditions using the custom prop value

---

<div class="post-metadata">

**Author:** ![Joel\_Farley](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@Joel\_Farley](https://forum.inductiveautomation.com/u/Joel_Farley)\
**Post date:** [July 1, 2024, 12:41am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/6 "2024-07-01T00:41:33Z")

</div>

what's wrong with the `tag()` function?

---

<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:** [July 1, 2024, 1:20am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/7 "2024-07-01T01:20:52Z")

</div>

> [@Indirect Tagging in Expression](https://forum.inductiveautomation.com/t/indirect-tagging-in-expression/86771/4):
>
> This will work, but note that for performance you should really use two custom properties with indirect tag bindings, and do the sum in a single expression referencing those two custom properties. The tag() function can't be optimized the same way indirect tag bindings can, so it's a performance pitfall.

> [@Indirect Tagging in Expression](https://forum.inductiveautomation.com/t/indirect-tagging-in-expression/86771/5):
>
> Fixed that for you. Really, if you are using the tag() expression function in a User Interface binding, you are screwing up. Full stop. The only appropriate place to use the tag() expression function is to perform indirection within an expression tag. Nowhere else.

There are many other posts like this

---

<div class="post-metadata">

**Author:** ![Joel\_Farley](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@Joel\_Farley](https://forum.inductiveautomation.com/u/Joel_Farley)\
**Post date:** [July 1, 2024, 1:59am UTC](https://forum.inductiveautomation.com/t/indirect-tag-in-an-expression-binding/92560/8 "2024-07-01T01:59:40Z")

</div>

Good to know. I agree with Transistor's comment on that post. This should be something included in the docs.

I guess I'll spend some time hunting for tag() functions today
