Can a Tag Change scripts be triggered by a UDT/template (not sub-tag changes)?

Hi,

My Tag Change scrips are not triggering when I look for a whole UDT/Template change.

I’m using UDTs to group a set of tags together that would be always updated together.
I’m also using scripting based on Tag Change.
I subscribe to all tag changes with path as [MQTT Engine]*

My issue is that my Tag Change event script is not triggered at the Template/UDT level:
[MQTT Engine]Edge Nodes/group/node/dev1/my_udt

My script is triggered at the sub-tags value change level:
[MQTT Engine]Edge Nodes/group/node/dev1/my_udt/speed1

The following is a Sparkplug message I pubish, all the sub-tags are updated as a group under value.mertics. I’m hoping to start my script based on all the metrics arriving.

{
   "timestamp":1604591089193,
   "metrics":[
      {
         "name":"my_udt",
         "type":"template",
         "value":{
            "metrics":[
               {
                  "name":"speed1",
                  "value":"542",
                  "type":"string",
                  "timestamp":1604591089193
               },
               {
                  "name":"speed2",
                  "value":"testnode",
                  "type":"string"
               }
            ]
         },
         "timestamp":1604591089192
      }
   ]
}

Is it possible to detect a value change of a UDT? Or do I need to detect a sub-tag change and then interogate each or the other tag values independantly?

I don’t believe you can detect a change in the UDT instance tag values as a whole; you can only detect single tag value changes.
Even if you could, this would fire whenever any of its tags changed, not when they’ve all changed, which I think is what you’re after?
You can read the timestamp of when a tag value has last changed, so you should be able to use that with each individual tag changed script to determine if all tags have updated or not, and when the last tag to update changes value, then run the rest of your script.

Thanks for clarifying Nick, that makes sense.