# Expression Tag inside a UDT

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-inside-a-udt/4373>\
**Category:** Ignition\
**Created:** [April 27, 2012, 9:08pm UTC](https://forum.inductiveautomation.com/t/expression-tag-inside-a-udt/4373 "2012-04-27T21:08:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [April 27, 2012, 9:08pm UTC](https://forum.inductiveautomation.com/t/expression-tag-inside-a-udt/4373/1 "2012-04-27T21:08:04Z")

</div>

Hello,

I want to add an Expression Tag inside a UDT but the expression I want to write is based in the AlertCurrentSeverity meta property of another OPC Tag inside the same UDT.

It’s something like this:

```auto
//UDT:
Pump {
   floatOPCtag Temp; //This has analog alerting
   floatOPCtag Level; //This also has analog Alerting
   intExpressionTag Status;
}

//Expression for Status:
if(Temp.AlertCurrentSeverity>Level.AlertCurrentSeverity,
   Temp.AlertCurrentSeverity,
   Level.AlertCurrentSeverity)

```

Colby gave me some hints using templates here  
[viewtopic.php?f=71&t=8032](http://www.inductiveautomation.com/forum/viewtopic.php?f=71&t=8032)  
but I can’t get it done using only UDTs

Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [April 27, 2012, 10:49pm UTC](https://forum.inductiveautomation.com/t/expression-tag-inside-a-udt/4373/2 "2012-04-27T22:49:21Z")

</div>

That’s considerably easier than the last problem. Here’s the expression you want:

`if({[.]Temp.AlertCurrentSeverity}>{[.]Level.AlertCurrentSeverity},
   {[.]Temp.AlertCurrentSeverity},
   {[.]Level.AlertCurrentSeverity})`

Basically, in any expression anywhere, you can refer to a tag through “{tagpath}”. A tag path can be relative or absolute, and the example above simply has the relative root source definition, “[.]”, required for referencing things inside of the UDT (the relative “[~]” would also work).

Anyhow, once you can reference a tag, you can reference a property of that tag through “.prop”.

Regards,

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [April 27, 2012, 10:56pm UTC](https://forum.inductiveautomation.com/t/expression-tag-inside-a-udt/4373/3 "2012-04-27T22:56:22Z")

</div>

Ahhhhh That is great!

I always get surprised of the simplicity of your answers!

Thanks a lot!!
