# Perspective Expression Binding for indirect values in a UDT

**URL:** <https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [March 11, 2022, 3:47pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115 "2022-03-11T15:47:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 11, 2022, 3:47pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/1 "2022-03-11T15:47:00Z")

</div>

(This is in 8.1.15 under Linux)

I have a UDT with a structure partially like:

```auto
UDTName
  |
  |--Folder1
  | |
  | +-Value1 (bool)
  |
  |--Folder2
          |
          +-Value2 (bool)

```

I’ve created a Perspective Embedded View that is a drop target for instances of this UDT, and linked the path of the instance to a view parameter called “TagPath”.

Using this configuration I have an object in the view that I can control the visibility of using Value1 via an Indirect Tag Binding:

![Tag_Indirect](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/6/46c6b3229e49e20e3dd4143bddeb9ddbcc6d4cb0.png)

But what I want to do is to control the visibility of comparing Value1 with Value2, EG the the result of the binding should the boolean expression of Value1 != Value2.

However I have no idea how to achieve this. I have tried various combinations of Tag/Expression bindings and pure Expression bindings but I can’t make it work.

How do I create a binding that is a function of two fields that are both indirectly referenced from within the same UDT?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 11, 2022, 3:53pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/2 "2022-03-11T15:53:45Z")

</div>

I’m not sure I understand, let’s see if I got this right:  
You basically want to use two indirect tags. Is that correct ?

I don’t have ignition on this machine so I can’t try things right now, but a simple solution would be to have two custom properties with indirect tag bindings, and compare those properties.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 11, 2022, 3:56pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/3 "2022-03-11T15:56:24Z")

</div>

Basically I want the result of the binding to be:

`{view.params.TagPath}/Folder1/Value1 != {view.params.TagPath}/Folder1/Value1`

But I don’t know how to achieve that

---

<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 11, 2022, 3:59pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/4 "2022-03-11T15:59:29Z")

</div>

Create two custom properties.

view.custom.value1 & view.custom.value2

Use an indirect tag binding on each property to the correct value1 or value2.

Then for CheckMark\_Missed.custom.Checked instead of a tag binding use an expression binding:

```auto
view.custom.value1 != view.custom.value2

```

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 11, 2022, 4:00pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/5 "2022-03-11T16:00:40Z")

</div>

So I have to jump through another level of indirection instead of referring to Value1 and Value2 directly?

---

<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 11, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/6 "2022-03-11T16:05:52Z")

</div>

Well, you could use the Tag() expression, but @pturmel will not be happy. 😆

Yeah, the extra indirection is needed in this case to achieve what you are attempting.

A tag binding can only resolve to 1 tag path and an expression binding cant have nested paths.

I suppose you could possibly use a script transform and manage to do it somehow that way, but really I think the indirection is the best option.

---

<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 11, 2022, 4:06pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/7 "2022-03-11T16:06:45Z")

</div>

Expression tags are the only place I would use the `tag()` expression function. I wouldn’t be unhappy if peter resorts to that.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 11, 2022, 4:14pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/8 "2022-03-11T16:14:24Z")

</div>

Well isn’t there some unwritten rule about not upsetting @pturmel 🤣

---

<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 11, 2022, 4:20pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/9 "2022-03-11T16:20:49Z")

</div>

There isn’t, I was just referring to his general distaste for the use of the function.

Usually, it isn’t used in the correct places and thus results in unneeded overhead in the form of extra trips to the gateway. I try to avoid using it so I don’t use it where it shouldn’t be.

Either way, an expression binding like this may work:

```auto
tag({view.params.TagPath} + '/Folder1/Value1') != tag({view.params.TagPath} + '/Folder1/Value2')

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 11, 2022, 4:56pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/10 "2022-03-11T16:56:40Z")

</div>

If you’re using those values somewhere else, you might as well have them as properties instead of reading them each time. Even if the reads are cached, I find it simpler to have a single property to reference.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 11, 2022, 5:00pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-binding-for-indirect-values-in-a-udt/57115/11 "2022-03-11T17:00:05Z")

</div>

That’s a good idea. I am using them individually so it makes sense to have a single point of truth for each of them
