Enable/Disable tags in UDT based on Parameter


I have a UDT for a piece of equipment which can have between 2 and 4 devices. I would like to enable the additional tags if they are required based on the value of a UDT parameter. Is there a way to do this or do I need to disable the additional tags manually?

We have utilized a structure like this in the past and have had no luck with dynamically enabling/disabling tags based on parameters.

Frankly, we’ve found success creating the UDT with the lowest amount of devices and then another UDT that inherits from that UDT. Decisions like this should be made with more of an understanding of the system that you are working with though, so take that with a grain of salt!

1 Like

The only way I can think of doing it would be to use a function which gives a zero for the values you need to disable at since that gets evaluated as false.

You might be on to something there. A “trigger” expression tag with a tag event script could write to the enable/disable on the desired tags. Not sure if you want to do all of that work in the UDT. Might be cleaner another way, but it could work