# Help with Tag Expression

**URL:** <https://forum.inductiveautomation.com/t/help-with-tag-expression/93326>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 17, 2024, 10:44am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326 "2024-07-17T10:44:49Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 17, 2024, 10:44am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/1 "2024-07-17T10:44:49Z")

</div>

Hello!

I have a box that I color it red depending of the value of a tag. However I need it to be dependent of 2 tags.

Let me show you:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0fb6cf08a1b4eadda38b712cd89b922f691a35d6.png)

As you may see, the tag is now set to "true".

I have another tag that is identical to the above one. I'm trying this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d5435253e806d575ca55e4ebc8b5add5a53fb742.png)

But for some reason I'm getting a configuration error.

Any idea what I'm doing wrong or what could do to fix it?

_I haven't show it, but I will add a map transform that returns the corresponding color dependign on the result of the expression._

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 17, 2024, 10:46am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/2 "2024-07-17T10:46:04Z")

</div>

I just noticed that I put `{./AfarviEmbeddedView.props.params.path}+"/Connected"` 2 times instead of the other name. However, it stil doesn't work.

_I promise the other tag works correctly._

---

<div class="post-metadata">

**Author:** ![deon.korb](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@deon.korb](https://forum.inductiveautomation.com/u/deon.korb)\
**Post date:** [July 17, 2024, 10:54am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/3 "2024-07-17T10:54:31Z")

</div>

That expression is only to construct the tag path, which then return the value of the tag.

You would need an expression, using the 2 tag values in the expression. There are many ways to achieve that, e.g. read your 2 tags into custom properties and then compare them.

Another option is to use `tag("path1")||tag("path2")` in an expression

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 17, 2024, 11:15am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/4 "2024-07-17T11:15:55Z")

</div>

Invalid tag path ☹

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/191fab6bae8025f34e9fdaecc3d8eaf205fe5053.png)

I'll add that the path is a parameter that I write in another component.

Something like this: `[UNS]Plant/Neo/Systems/AGVSystem/Connection01`  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/7/87c0b13e972f98000ae75b75a0a6fd1aee399508.png)

---

<div class="post-metadata">

**Author:** ![deon.korb](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@deon.korb](https://forum.inductiveautomation.com/u/deon.korb)\
**Post date:** [July 17, 2024, 11:17am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/5 "2024-07-17T11:17:19Z")

</div>

You are doing a tag binding, with the expression constructing the path.

Use an actual expression binding:

> **[Expression Bindings in Perspective | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/bindings-in-perspective/expression-bindings-in-perspective)**
>
> Binding Properties to the Outcome of an Expression

---

<div class="post-metadata">

**Author:** ![Mark\_Minuth](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mark\_Minuth](https://forum.inductiveautomation.com/u/Mark_Minuth)\
**Post date:** [July 17, 2024, 12:10pm UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/6 "2024-07-17T12:10:44Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/89f771f4be28b72e74f2b1e9524f2fdbcceef0b4.png)  
Like Deon said, you're currently using an expression to build the tag binding. You want the expression binding below.

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 17, 2024, 12:13pm UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/7 "2024-07-17T12:13:56Z")

</div>

> [@danielps1818](#):
>
> {./AfarviEmbeddedView.props.params.path}+"/Connected"

Thanks!

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 17, 2024, 12:14pm UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/8 "2024-07-17T12:14:01Z")

</div>

Thanks!

---

<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, 2024, 12:21pm UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/9 "2024-07-17T12:21:28Z")

</div>

> [@deon.korb](#):
>
> Another option is to use `tag("path1")||tag("path2")` in an expression

This is _ **extremely** _ bad advice. The `tag()` expression function has numerous problems in UI bindings. Move the indirection into separate bindings on custom properties, then use an expression binding that references those two properties.

Use the `tag()` expression function only in expression tags, not in any other kind of binding.

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 18, 2024, 9:25am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/10 "2024-07-18T09:25:20Z")

</div>

@pturmel I ended up doing this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/5/25af5f42a1ab74593d5a6ec6c17df0f36ce148bf.png)

I don't quite get why I would have to do it in custom properites. What does it change?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 18, 2024, 11:35am UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/11 "2024-07-18T11:35:52Z")

</div>

> [@danielps1818](#):
>
> I don't quite get why I would have to do it in custom properites. What does it change?

The performance of tag() leaves a lot to be desired. It will perform better if you use a custom property with an idirect tag binding for each tag, then bind the stroke to an expression that uses those two custom properties.

---

<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 18, 2024, 12:44pm UTC](https://forum.inductiveautomation.com/t/help-with-tag-expression/93326/12 "2024-07-18T12:44:47Z")

</div>

Expression bindings are **synchronous**. They **must** return a value when executed. The `tag()` expression function **stalls** when first called, waiting for a reply to its subscription request. If you scatter `tag()` expression functions through a bunch of bindings in a commonly-used view, you will have stalls on those views that are the sum of all the stalls in the bindings.

Tag bindings don't stall. They simply don't produce any property assignment at all until the subscription answers, and only produce future assignments when the subscription delivers changes.
