Tag change script on UDT

Can use tag change script on instance of UDT by tracking the UDT?
Consider I have 5 instances of a UDT, and if any of them changes, I want to run a script. I do not want to write a tag change script for individual instance.

Yes, just put the script into the tag within the UDT definition's tag change event. You should make sure your script executes in the sub 100ms range

sub 10ms range for events defined on tags. 100ms is a good rule of thumb for most other non-UI events, and a good rule for user-triggered UI events.

@nminchin I tried that and it only gets executed when the UDT definition changes and not if the value of one of the instance changes.

Can you show a screenshot of your script including the context of where it's located?

This is the gateway script for tag change of UDT "test"

This is the script I want to run if any of the Instance value get updated

This is the tag instances for UDT "test", I do not want to write the same tag change script for each individual test instances.

If you want a script to run on every instance of a UDT automatically, you want a tag event script, not a tag change script:
https://docs.inductiveautomation.com/display/DOC81/Tag+Event+Scripts

Honestly I'm surprised we allow you to add a change script to UDT definitions. I guess it could theoretically be useful, but is almost certainly not what anyone intended to do.

1 Like

Thank you for the solution, I will try this approach.

I want to recall.
Is this practice related to the your advice that execution of biding script must be fast? and long processing script must be place on project script and called from the binding script.

What is the reasoning for this? and what is the symptoms if I have a long execution script on the binding?

--i like to know, coz I work with a team, before I tell them I need to know the why.

Some topics to read (follow nested topics, too):

1 Like

Thank you very much for this..

Will read, and get back here for any conclusion I make.