# Expression in UDT

**URL:** <https://forum.inductiveautomation.com/t/expression-in-udt/73288>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 4, 2023, 8:35pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288 "2023-05-04T20:35:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 4, 2023, 8:35pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/1 "2023-05-04T20:35:38Z")

</div>

I have this expression here:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/9/49ba5e5ef8bfe457498dd54e7e46ce9fa2372dbb.png)

How do I add the UDT params to this expression? Is this right, since the text isnt purple.

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 4, 2023, 9:20pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/2 "2023-05-04T21:20:25Z")

</div>

Usually the binding preview at the bottom of the binding editor will show you if your expression is working and gives you a red error message if not. Hovering over the error message will give you a clue what the problem is.

Change  
`{[.]L{Line_Num]_SideExtr_{Extr_Num} ...`  
to  
`{[.]L{Line_Num] + "_SideExtr_" + {Extr_Num} ...`

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 4, 2023, 9:34pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/3 "2023-05-04T21:34:37Z")

</div>

Like this?

```auto
{[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Clr_Profile_Pump"}>{[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Bopu_PID_Tmp_Ctrl_Spt"}||{[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Clr_Profile_Pump"}<{[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Bopu_PID_Tmp_Ctrl_Spt"}

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 4, 2023, 9:49pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/4 "2023-05-04T21:49:16Z")

</div>

> [@mjohnson0238](#):
>
> Like this?

Yes. Did you check the result in the Binding Preview?

Tip: you can use line breaks (and comments) in your expressions to make them more readable.

```auto
   {[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Clr_Profile_Pump"}
> {[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Bopu_PID_Tmp_Ctrl_Spt"}
|| {[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Clr_Profile_Pump"}
< {[.]L{Line_Num] + "_SideExtr_" + {Extr_Num] + "__Bopu_PID_Tmp_Ctrl_Spt"}

```

I'd also add in a space each side of the `>` and `||` operators to let your expressions breath!

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 5, 2023, 12:57pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/5 "2023-05-05T12:57:52Z")

</div>

The binding preview isnt showing. Comparing to what you have here I found my error. Thank you @Transistor

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 5, 2023, 5:16pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/6 "2023-05-05T17:16:32Z")

</div>

> [@mjohnson0238](#):
>
> The binding preview isnt showing.

That's odd. It would be worth figuring out why not. Post a (nicely cropped) screengrab of the binding editor window.

Don't forget to mark the solution - if you're happy that was the solution.

---

<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:** [May 6, 2023, 1:41pm UTC](https://forum.inductiveautomation.com/t/expression-in-udt/73288/7 "2023-05-06T13:41:12Z")

</div>

I think @Transistor got confused by you tagging Perspective when you're not talking about perspective at all, but binding expressions in presumably an expression tag? Maybe?

To read an indirect tag in the expression language, you need to use the `tag()` function. Eg

```auto
tag('[.]L' + {Line_Num} + '_SideExtr_' + {Extr_Num}...)

```

However, I'm not sure if the tag function supports relative references (I've never tried it), and I'm also not entirely sure the tag function is supported by an expression tag expression 🤔

Although you said you found your error... It'd be nice if you shared what it was, otherwise this whole topic will be useless to someone in the future with the same issue
