# UDT with nested UDT and instance the parent UDT with proper name of the child UDT

**URL:** <https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 26, 2024, 2:06pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398 "2024-06-26T14:06:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Lai](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Richard\_Lai](https://forum.inductiveautomation.com/u/Richard_Lai)\
**Post date:** [June 26, 2024, 2:06pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/1 "2024-06-26T14:06:55Z")

</div>

Hello Gents, I try to implement Tag instance in the UDT definition, noticed the name of the instance seems not able to be changed, i.e I have UDT call UDTa and UDTb, within the uDTa , I created a tag instance of the UDTb and named it as memberB, in the controller I have tag call PT101 which is the instance of the UDTb. When I instance this UDTa, I would like to have the memberB name changed to real tag name say PT101, is there any way can do that?

---

<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:** [June 26, 2024, 2:17pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/2 "2024-06-26T14:17:23Z")

</div>

No, member names within UDTs are fixed, just like it would be with a "C" language structure.

---

<div class="post-metadata">

**Author:** ![Richard\_Lai](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Richard\_Lai](https://forum.inductiveautomation.com/u/Richard_Lai)\
**Post date:** [June 26, 2024, 2:22pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/3 "2024-06-26T14:22:58Z")

</div>

Thanks for the quick reply. So, is there way I can UDT with two parent UDTs?

---

<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:** [June 26, 2024, 2:27pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/4 "2024-06-26T14:27:38Z")

</div>

You mean "mixing" members of one with members of another? No. "C" doesn't do that either.

If you need dynamically named members or a variable number of members, then you need a tag folder, not a UDT.

But keep in mind that part of the point of UDTs is to establish a consistent set of names that will make user interface parameterization work. Don't break that paradigm or you will suffer for it.

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [June 26, 2024, 2:35pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/5 "2024-06-26T14:35:37Z")

</div>

What are you trying to achieve that you can't do with a UDT parameter or by creating a memory tag called "udtName" inside UDTa and UDTb?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 26, 2024, 6:33pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/6 "2024-06-26T18:33:16Z")

</div>

You wouldn't want to do that anyway because then you lose the biggest advantage of Ignition, which is rather simple indirection. You want your sub-UDTs to be named the same so you always know where the relevant tags are.

What you _really_ want is a string parameter that binds to a string memory tag in the UDT.

You'll end up with a string parameter to the parent UDT that is then bound to part of each of the sub-UDT parameters.

For instance,

```python
Parent.Name = PT101
Parent.UDTa.Name = {Parent.Name}a
Parent.UDTb.Name = {Parent.Name}b

```

Pseudo-code, of course

---

<div class="post-metadata">

**Author:** ![Richard\_Lai](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Richard\_Lai](https://forum.inductiveautomation.com/u/Richard_Lai)\
**Post date:** [June 27, 2024, 5:39pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/7 "2024-06-27T17:39:27Z")

</div>

Thanks for you guy's answer, what I really like is to archieve is that to allow the UDT instance reflect the device directly. i.e. I have a device called Storage Tank, and I have 5 same Storage tanks, each tank has common attributes say ID, description, locationetc. and one level transmitter and one valve, the transmitter and valve have their own structure which are defined as UDTb and UDTc, the Tank will be defined as UDTa. for the tank 1 the level transmitter is LT101 and Valve is SV101, Tank 2 has LT102 and SV102 and so on, it would be nice and straight forward for Tank1/LT101 and Tank1/SV101 rather thanTanks1/Level Transmitter/LT101 and so on.

---

<div class="post-metadata">

**Author:** ![Richard\_Lai](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Richard\_Lai](https://forum.inductiveautomation.com/u/Richard_Lai)\
**Post date:** [June 27, 2024, 6:15pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/8 "2024-06-27T18:15:44Z")

</div>

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

This will be much easier for understanding what I want to do.

---

<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:** [June 27, 2024, 6:36pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/9 "2024-06-27T18:36:29Z")

</div>

Well, you cannot. UDTs have a fixed structure within instances. 🤷‍♂️

And that would break ordinary tag path parameterization in any user interface you build.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [June 27, 2024, 9:34pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/10 "2024-06-27T21:34:45Z")

</div>

You should be using folders with tags created with those UDT instances in this case instead of nested UDT instances.

---

<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 27, 2024, 9:38pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/11 "2024-06-27T21:38:38Z")

</div>

> [@pturmel](#):
>
> establish a consistent set of names that will make user interface parameterization work

This breaks me sometimes, since usually I would name UDT instances with their p&id label (BL01\_FT101 for example) but for parts where it makes sense to template them, you can't do that, so you have to name them something else. I normally use a more descriptive name in this case like Inlet Flow, but it breaks the standard of using p&id labels which I don't like.. But of course, as you said, without fixed names, parameterisation of graphics is impossible

---

<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:** [June 27, 2024, 9:51pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/12 "2024-06-27T21:51:36Z")

</div>

Well, dynamic data needs to be **in** a tag, or in a tag property. And when parameterizing a UI, those names are, in fact, dynamic. 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 27, 2024, 10:27pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/13 "2024-06-27T22:27:47Z")

</div>

Display-wise on the interface side it's still relatively easy to do so with memory string tags bound to string parameters.

Also, you could name them generically like "FIT-XXXX" and "PIT-XXXX" etc

---

<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, 2024, 12:25am UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/14 "2024-06-28T00:25:27Z")

</div>

> [@amarks](#):
>
> Display-wise on the interface side it's still relatively easy to do so with memory string tags bound to string parameters

Instead of extra tags, I just bind to the UDT instance parameter values which works. It's really just an "issue" in the display in the designer and for selecting trend tags if you're using the standard tag browser tree view (i've made my own which uses the params).

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 28, 2024, 1:11pm UTC](https://forum.inductiveautomation.com/t/udt-with-nested-udt-and-instance-the-parent-udt-with-proper-name-of-the-child-udt/92398/15 "2024-06-28T13:11:45Z")

</div>

That's true if you're providing custom trends like that. I use unique suffixes on my UDT parameters (for inheritance/nesting reasons) but the same template might be used by different UDTs so using the parameters directly doesn't work in my case, which is why they're bound to memory tags that share the same location and name within every UDT.

Just thought of another alternative solution, as part of the "parent" UDT there could be a memory tag of some sort which specifies the relevant "sub-UDT" locations/tag(s) that are used for indirection, if you're worried about how tags are displayed in the tag tree. This would keep your sensors all in one folder and still allow them to be easily referenced within templates for the "parent" UDT.
