Add new member to UDT instances

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.

Dynamically subclass the UDT, perhaps?

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

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.

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.

1 Like

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.

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