# Add new member to UDT instances

**URL:** <https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841>\
**Category:** Ignition\
**Created:** [December 20, 2022, 5:58pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841 "2022-12-20T17:58:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [December 20, 2022, 5:58pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/1 "2022-12-20T17:58:40Z")

</div>

I wonder if it is only me that needs this option or if other people do something else.

I use UDT as a unit of the task to run my logic. Users instantiate UDT during runtime and pass some parameters to it to config it. The problem is some cases I need dynamically add some tags to fulfill some other requirements during runtime to the UDT instances. These new tags are totally dynamic and can't define in the base UDT.

Even if we have Array Tag with another UDT as type is good for me.

Thanks for any help or idea.

---

<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:** [December 20, 2022, 6:17pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/2 "2022-12-20T18:17:07Z")

</div>

Dynamically subclass the UDT, perhaps?

---

<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:** [December 20, 2022, 6:18pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/3 "2022-12-20T18:18:27Z")

</div>

Maybe include a Document tag in the UDT for arbitrary extra information?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [December 20, 2022, 6:23pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/4 "2022-12-20T18:23:17Z")

</div>

> [@pturmel](#):
>
> UDT

Hi Phil,  
Could you please explain what is the subclassing?

The document is not good for me as I want to add another UDT instance inside my main UDT.  
I imagine in SPC application I create a UDT for Sample Definition. But each Sample Definition may have several dynamic numbers of the Attributes(Another UDT) which are defined by the user.

I use to create some sort of Timer and event handler for Sampling. All Logic is embedded in the UDT's tags.

---

<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:** [December 20, 2022, 6:33pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/5 "2022-12-20T18:33:58Z")

</div>

> [@nader.chinichian](#):
>
> explain what is the subclassing?

A parent UDT. When a UDT has a parent, it inherits (subclasses) all of its members. You then define the **additional** members you want. These can be instances of other UDTs.

So you would need two operations: `system.tag.configure()` to create the dynamic UDT in `_types_`, given a parent UDT and the additional members. Then `system.tag.configure()` to create an instance of this new UDT.

Perhaps, if there are many variations, consider using a tag folder to hold the base UDT at a predefined name, and then all of the dynamic stuff as peers of the UDT instance. You would refactor your logic so that the UDT instance is one level deeper than currently.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [December 21, 2022, 4:26am UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/6 "2022-12-21T04:26:47Z")

</div>

Thanks Phil,

I probably use second method with folder which include one base udt instances with the same name as folder and when user add attribute I create a new instance in that folder.

As the number of attributes for each sample is quite dynamic and can be changed anytime it is not possible to use first method.  
I wish IA add this feature.

---

<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:** [December 21, 2022, 2:13pm UTC](https://forum.inductiveautomation.com/t/add-new-member-to-udt-instances/67841/7 "2022-12-21T14:13:01Z")

</div>

> [@nader.chinichian](#):
>
> I wish IA add this feature.

From what I can see, it would be brutally difficult. Don't hold your breath.
