# Tag Binding with Expression

**URL:** <https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 13, 2024, 6:03pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292 "2024-03-13T18:03:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 6:03pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/1 "2024-03-13T18:03:51Z")

</div>

Is it possible to link the binding to a tag with an expression like the below:

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

I can't figure this out. I am actually able to link with expression when expression is selected on the left, but not able to link with expression when tag is selected on the left.

---

<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:** [March 13, 2024, 6:08pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/2 "2024-03-13T18:08:21Z")

</div>

Here's the pertininent info in the manual. That said, what are you really trying to do?

> **[Tag Bindings in Perspective | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/bindings-in-perspective/tag-bindings-in-perspective#tag-expression-binding)**
>
> A Tag binding is a straight-forward binding type. It simply binds a property directly to a Tag Property (typically the value). This sets up a subscription for that Tag. Every time the chosen Tag changes, the binding is evaluated and pushes the new...

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 6:16pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/3 "2024-03-13T18:16:44Z")

</div>

I'm trying to setup dynamic binding therefore I need an expression.

---

<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:** [March 13, 2024, 6:29pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/4 "2024-03-13T18:29:03Z")

</div>

Have you tried indirect binding?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [March 13, 2024, 6:30pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/5 "2024-03-13T18:30:42Z")

</div>

> [@JordanCClark](#):
>
> Have you tried indirect binding?

I suspect this is really what you need to use

Is the tag path you are trying to bind to wildly changing, or is it another tag in the same folder or a different sibling folder with the same structure? Which part of the tag path will be changing?

If possible try to provide more information on how your system is set up and what you are trying to achieve. Something along the lines of:  
I have a standard folder structure of `Foo` which contains tags `bar` and `est`. I have 4 machines with folders that follow this structure and I want to bind the value of `est` to a label component based on the folder/machine I have selected.

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 6:50pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/6 "2024-03-13T18:50:31Z")

</div>

I tried indirect binding and of course it works for me, but this is not what I want. As I said before, I want to use the expression and since the option is available there, it should be possible right???. There will be some logic in my expression which I would not be able to do with the indirect binding.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [March 13, 2024, 6:55pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/7 "2024-03-13T18:55:12Z")

</div>

In that expression you are passing the value from the tag you've written there. You can tell because its surrounded with `{}`. I'm assuming ignition wants to see a string returned from the expression which it will then interpret as a tag path to bind indirectly. Try replacing the `{}` with `" "`.

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 6:57pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/8 "2024-03-13T18:57:56Z")

</div>

I am not sure Ryan, therefore I wanted to know what is the syntax. I was able to do an expression which reads from the tag before, but that was using the actual expression Binding Type. In this case I want it to work bidirectional, therefore I wanted to use the Tag binding type.

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 7:01pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/9 "2024-03-13T19:01:54Z")

</div>

Right, so this expression works as you can see.

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

The same expression does not work for the Tag Binding type. So what is the syntax I'm asking basically.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [March 13, 2024, 7:05pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/10 "2024-03-13T19:05:32Z")

</div>

> [@Aron\_Grzywaczewski](#):
>
> The same expression does not work for the Tag Binding type

Correct, because that binding is returning the **value** of the tag at that path (that's what the `tag` function does). For the tag type binding, it wants to see a tag path, not a tag value. Your expression binding for the tag binding type should just be

```auto
"[default]ReadPoints/WTN_M7/DataWrite/Vsl_NameWrite"

```

---

<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:** [March 13, 2024, 7:06pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/11 "2024-03-13T19:06:06Z")

</div>

> [@ryan.white](#):
>
> should just be

Leave off the quotes for a plain tag binding. Include the quotes for an expression tag binding. Leave off the quotes, and put in a curly brace placeholder, to use indirect binding.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [March 13, 2024, 7:08pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/12 "2024-03-13T19:08:54Z")

</div>

Definitely read the manual/check the videos as well.

Quick snippet from the manual for the type of binding you are attempting:  
"The tag path in the Expression is expected to be a string. Note that is different and not to be confused with an [Expression Binding](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/bindings-in-perspective/expression-bindings-in-perspective)."

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 7:10pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/13 "2024-03-13T19:10:15Z")

</div>

Yeah, thanks pturmel, Actually just figured it out:

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

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 7:11pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/14 "2024-03-13T19:11:38Z")

</div>

Found this in manual actully pointed me to the right direction:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/72a908c10b11b7265ef7d2496b9275c83c7c04ad.png)

I was using the tag button on the right of the screen to create the connection to my tag and it did not work. I think that maybe it's something that could be fixed in the future versions of Ignition as I believe that using this in this context should actually resolve the path to the tag and paste it in the quotation marks in the expression window.

---

<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:** [March 13, 2024, 7:36pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/15 "2024-03-13T19:36:02Z")

</div>

> [@Aron\_Grzywaczewski](#):
>
> tag button on the right of the screen to create the connection to my tag

That would be used to identify a tag that will supply a string containing the path to **another** tag, or to supply conditions for the expression to **yield a string**.

Summary:

- Direct tag binding: Put the complete path to the tag, without quotes, into the top field.

- Indirect tag binding: Put part of the path to the tag, without quotes, into the top field, plus a curly-brace placeholder for the part of the tag name you wish to be dynamic. In the parameter section below, indicate where you want to get that part.

- Expression tag binding: Put a **computation** that yields a string that will be the complete name of the the tag.

Use in that order, for best efficiency. Don't use expression tag bindings where you are just injecting something else into the name. Use indirect for that.

---

<div class="post-metadata">

**Author:** ![Aron\_Grzywaczewski](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Aron\_Grzywaczewski](https://forum.inductiveautomation.com/u/Aron_Grzywaczewski)\
**Post date:** [March 13, 2024, 8:57pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/16 "2024-03-13T20:57:56Z")

</div>

I've seen in some other editors (In Ignition) that selecting the tag from the right pane actually inserts the tag full path string in quotation.

In this editor using the button inserts the full path string in the Curly Brackets. The curly brackets are generally used for referencing the objects in Ignition from what I've seen so it does not make sense to me.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 13, 2024, 9:14pm UTC](https://forum.inductiveautomation.com/t/tag-binding-with-expression/87292/17 "2024-03-13T21:14:58Z")

</div>

> [@Aron\_Grzywaczewski](#):
>
> In this editor using the button inserts the full path string in the Curly Brackets

In an expression, curly brackets are used to delineate a path (tag path, property path, etc...), that the expression should try to use the value of. Behind the scenes the paths are parsed to determine if they are a path to a property or a tag, and either a BoundTagExpression or BoundPropertyExpression is created. Effectively the component is "listening" for a change in those expressions.

A path in quotations is just a string.
