# Template using UDT param: Can you access UDT tag metadata?

**URL:** <https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179>\
**Category:** Ignition\
**Created:** [June 28, 2015, 2:43pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179 "2015-06-28T14:43:11Z")\
**Posts on this page:** 19\
**Page:** 1

<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:** [June 28, 2015, 2:43pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/1 "2015-06-28T14:43:11Z")

</div>

Hi all,

I’m new to Ignition and have tried searching for this already with no luck.

I have a template with a UDT as a parameter that contains some OPC tags. Can I access the metadata (e.g. Eng Units / Min/Max range, etc.) of this UDT parameter’s tags from inside the template? e.g. something like (which doesn’t work) {Tank Template.Tank::Temperature.PV.EngHigh}  
Where:  
Tank Template is the template  
Tank is the UDT parameter  
Temperature.PV is an OPC tag within the UDT  
EngHigh is the metadata I want to retrieve

Cheers,

Nick

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [July 1, 2015, 6:20pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/2 "2015-07-01T18:20:07Z")

</div>

Greetings Nick,

I had some success using the tag() expression function along with the TagPath (located in the “Meta” folder on the UDT property). The TagPath only navigates to the root of the UDT, so you’ll have to concatenate the tag name and EngHigh. Try the following:

```auto
tag({Tank Template.UDT::Meta.TagPath} + "/Temperature.PV.EngHigh")
```

---

<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:** [April 10, 2017, 10:42pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/3 "2017-04-10T22:42:11Z")

</div>

Having more experience in using Ignition now, it’s worth noting that using UDT parameters within template symbols is **_not_** recommended. It’s much more efficient and scalable to bind the path to the UDT instance instead, and then concatenate the relative path to the tag onto that.

Using a UDT parameter has two major down sides:

- all tags within the UDT are subscribed to, meaning higher load and potentially slower client and server performance, especially if a number of the template instances are displayed on the page.
- it’s impossible to reuse the template symbol for another, similar UDT

---

<div class="post-metadata">

**Author:** ![Caleb\_Bohon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/caleb_bohon/32/3293_2.png) [@Caleb\_Bohon](https://forum.inductiveautomation.com/u/Caleb_Bohon)\
**Post date:** [April 11, 2017, 1:11am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/4 "2017-04-11T01:11:49Z")

</div>

Nick,

That sounds sensible if the template is only using part of the data.

Do you think it is better to use the parameter way if the Template is using all the data, or is the path method always better?

-Caleb

---

<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:** [April 11, 2017, 1:27am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/5 "2017-04-11T01:27:42Z")

</div>

I would always use the tag path way and would avoid using UDT template parameters altogether. I’ve been bitten before when a new UDT was created which was fairly similar and I wanted to reuse the same templates and detail pages, but due to the template and page using a pre-defined UDT parameter, I couldn’t. I ended up re-coding these templates and pages to instead use the tag path which allows a lot more flexibility in the future for reuse.

---

<div class="post-metadata">

**Author:** ![scott2](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@scott2](https://forum.inductiveautomation.com/u/scott2)\
**Post date:** [April 12, 2017, 10:16am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/6 "2017-04-12T10:16:52Z")

</div>

I may not be understanding you correctly, but are you saying not to use ‘drop targets’?  
Whilst i’m not an expert, i’m not a beginner either.

If i have say a motor template, that has a custom property of Motor UDT type, that is also a drop target, when the template is placed on the screen all the UDT parameters are subscribed to, even if they are not animated or alarmed/historised?

---

<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:** [April 13, 2017, 8:08am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/7 "2017-04-13T08:08:42Z")

</div>

Correct: all tags within the UDT are subscribed to, no matter if the tags are displayed or not. Depending on the size of your UDTs and the number of templates using these UDTs that are shown on the page, this can be a significant number of tags which may cause performance issues.  
And correct, not using UDT parameters also means that you’re not able to use your UDT instances as the drop targets.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [June 22, 2017, 12:18pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/8 "2017-06-22T12:18:03Z")

</div>

We’ve just been bitten by this too.

A touchscreen we use has a quite slow CPU, opening a motor popup took 1s to show the popup window, and another 7-8 seconds to visualise the tag data. During that time, the CPU was constantly running at 100%. I would have thought that opening a popup would be influenced mostly by network speed (getting the data from the server) or graphical power (rendering the screen itself), but it turns out to be CPU intensive.

Changing the popup to accept a tagpath parameter instead of an UDT parameter fixed the issue. It still take 1s to show the popup window, but all data is visualised immediately when the popup opens.

Strangely, it also doesn’t depend on subscribing to the UDT. When we were halfway through changing the references on that popup, we kept the UDT reference but derived it from the tagpath (which is easy enough to do via indirect tags). The popup already loaded twice as fast as before.

When you do it the other way around however, bind the tagpath to the UDT via the meta-data (and keep the UDT as parameter), the popup stays slow.

So it looks like for every lookup that needs to happen through the UDT (either directly or indirectly), a relatively large amount of CPU power is needed, while that isn’t the case when you use the tagpath without passing through the UDT meta data.

Having an unused UDT still defined as parameter on the popup doesn’t seem to make a speed difference, as long as you don’t use the UDT.

This is all very counter-intuitive to us, as we thought it would have been easier for Inductive Automation to optimise the CPU usage when using an UDT instead of referencing every tag value separately. And the issue isn’t related to subscribing to all tags, but instead related to how much you effectively read from it.

The only thing we can guess is that for every parameter read, the client will acquire the entire UDT to get the parameter from it, which sounds extremely wasteful.

---

<div class="post-metadata">

**Author:** ![j.israelsen](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@j.israelsen](https://forum.inductiveautomation.com/u/j.israelsen)\
**Post date:** [June 13, 2018, 3:26pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/9 "2018-06-13T15:26:44Z")

</div>

Two follow up questions:

(1) To clarify, is the method you are suggesting something like the following (reference pscott post above)? If not, please present and example of how you would use the tag reference.

tag({Tank Template.UDT::Meta.TagPath} + “/Temperature.PV.EngHigh”)

(2) Is the issue with using UDT parameters also occur with other things or is this just for templates? For example say I have a popup with a custom parameter which is a UDT. Would I experience slow downs if I use UDT parameters from my popup custom parameter?

---

<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:** [June 14, 2018, 9:56am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/10 "2018-06-14T09:56:29Z")

</div>

1. 

No no, in your example you are still using a UDT type parameter. You are far better off to pass in the actual tag path to the UDT instance as a string, and then do exactly the same thing in your example with that.  
E.g.  
Parameter: TagPath [String]  
TagPath = "Tank Farm/Tanks/Tank 1"  
Expression: tag({Tank Template.TagPath} + '/Temperature/PV.EngHigh)

1. 

If you can pass in a UDT type into a popup without including the UDT type in the object/template you're calling it from, then this most likely won't have any performance impacts, as it will only contain one UDT type. I'm not sure that you can actually do that though... I don't know if you can actually pass in the UDT type without have it as a parameter of the object or an object in the Window. I remember trying this and kept getting the error:  
`ValueError: Error setting parameter: bob. Could not convert System/PLCs/Diagnostics/Boiler into UDTProperty.`

That's using the script:  
`window = system.nav.openWindow('Main Window (1)', {'bob' : 'System/PLCs/Diagnostics/Boiler'})`

where 'System/PLCs/Diagnostics/Boiler' is the path to a UDT instance. The function is looking for a UDTProperty object type, and I'm passing in a string. I don't remember being able to find a function to effectively look up the tag path and return the object, and I certainly wouldn't try using browseTags for that due to it's own performance impacts.

> [@Disabled tag breaking Expression tag expression](http://forum.inductiveautomation.com/t/disabled-tag-breaking-expression-tag-expression/15092/5):
>
> Careful with this approach. system.tag.browseTags is a performance killer and pretty much always hits the internal DB, which cannot be accessed concurrently. Too many scripts/events in the system invoking browseTags can make access to the internal DB highly contested and bring down a bunch of other parts of the system.

---

<div class="post-metadata">

**Author:** ![j.israelsen](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@j.israelsen](https://forum.inductiveautomation.com/u/j.israelsen)\
**Post date:** [June 14, 2018, 2:09pm UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/11 "2018-06-14T14:09:41Z")

</div>

Okay, got it. Thanks for the quick and clear response.

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [April 16, 2020, 2:42am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/12 "2020-04-16T02:42:37Z")

</div>

And if we have many instances of the same type ?it will be difficult to position the path of each instance in the template.

---

<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:** [April 16, 2020, 2:51am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/14 "2020-04-16T02:51:03Z")

</div>

Compared to the limitations of using UDTType parameters, I would **much** prefer to have to type in the tag path.  
Just FYI I don’t use tagpath (anymore?), I split these up now into:

- deviceParentPath
- deviceName

Then I bind an internal `deviceTagPath` parameter to combine these two parameters. This makes it easier, more flexible, and much faster to populate instances with values.

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [April 16, 2020, 2:56am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/15 "2020-04-16T02:56:09Z")

</div>

I’m not understanding you much…  
I have a UDT and a template, so I associate the template with the udt, then in the template I have components related to the udt tags. So I understand that this is going to slow down the system. do not ?  
on the other hand I have many instances of the udt

---

<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:** [April 16, 2020, 3:14am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/16 "2020-04-16T03:14:59Z")

</div>

I'm not entirely sure what your question is.

You can have a UDT or number of UDTs that can be represented by a Template.  
I add DeviceParentPath and DeviceName string template parameters, and DeviceTagPath as a string internal parameter.  
If you use a single UDTType parameter and link that to a single UDT, you will have a number of limitations:

> [@To UDT or not to UDT. That is the question](http://forum.inductiveautomation.com/t/to-udt-or-not-to-udt-that-is-the-question/32703/15):
>
> at a glance, it’s not possible to see by looking at a component’s properties which UDT instance has been bound to a UDT type property. E.g. in the screenshot below, I have no idea which Tower UDT is bound, I have to click on the binding to find out. It’s also far slower to populate template parameters than simply modifying a parameter string value. I tend to use 2 parameters: DeviceParentPath and DeviceName, then combine these together in an internal parameter DeviceTagPath, which also aids in…

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [April 16, 2020, 3:37am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/17 "2020-04-16T03:37:09Z")

</div>

my question is: if in Template Parameters do I use the UDT it affects performance? since in my project I have many instances of the same UDT, and for all the instances I must use the same template.  
as I just read in your answer it doesn’t affect it using ignition 8

---

<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:** [April 16, 2020, 3:43am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/18 "2020-04-16T03:43:41Z")

</div>

Performance-wise, the release notes (I can’t find the reference, but remember reading it somewhere) mention that they’ve significantly increased performance for UDTType bindings compared with 7.9.  
Again though, you’re still stuck with the other limitations.

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [April 16, 2020, 4:13am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/19 "2020-04-16T04:13:07Z")

</div>

Thank you very much.  
now how can i access a UDT tag property from the template. I have used the following but it does not work  
tag({test.dt::Meta.TagPath}+ “/V\_CLOR/Alarms/High.HasActive”)

in the capture, "TEST"is the name of the udt instance. the tag “V\_CLOR” have an alarm called “High”

 ![36](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/317d8aa6a816a23a5a6190fada87869a1499d98e.png)

---

<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:** [April 16, 2020, 11:30am UTC](https://forum.inductiveautomation.com/t/template-using-udt-param-can-you-access-udt-tag-metadata/10179/20 "2020-04-16T11:30:18Z")

</div>

Probably also want to ditch your use of the tag() expression function.

> [@Nesting Not Allowed while using Properties in a Template to turn on a Light](http://forum.inductiveautomation.com/t/nesting-not-allowed-while-using-properties-in-a-template-to-turn-on-a-light/33609/16):
>
> Yes, there is. If the items that comprise your tagpath are updated, even if yielding the same result path, the entire expression containing the tag() function will have to execute. With indirect binding, this doesn’t happen. The strings themselves have to be reconstructed every time, even if not changing, slowing down the final expression execution. There are a few cases with computed gateway tags where the tag() expression is the only good way to do indirection, and the dynamic stuff above…
