Modify UDT parameter in a Script

I have a UDT for some AGVs with various parameters. The AGV locates to what we call ID Points which are in different stations through the line. I want to have a script get the ID point and from that ID point change the “Station” parameter. So I can use it later on an alarm to know which AGV on which Station is faulted.

I’m pretty new to scripting so I want to understand if this is possible. I don’t really want to do it in the expression of the alarm because it will be lentgthy and I think it can be shorter in a script.

Hello imt.sebastian.sanche!
With scripting you can write to UDT parameter the same way you write to tags. You just to specify the proper path to the parameter. IE: [default]tree1 is my UDT instance. Then [default]tree1/Parameters.myString1 would be to my UDT parent parameter called “myString1”

Hello Plo,

Can I do the same but to the data type itself (not an instance) so every instance gets their parameter updated?

system.tag.writeBlocking("[default]_types_/myUdt/Parameters.Reset", [1])

It sort of works.
When I open the UDT type I see the parameter value changes, nice.
However, when I open an instance in the tag browser the parameter value doesn't change.


Has that parameter been overridden in that instance ?

@pascal.fragnoud No, it's not overridden in the instance. A colleague suggested it may not update in the tag browser because their isn't a time stamp associated with it.

I'm not seeing this behavior in 8.1.21. Writing to a udt parameter with system.tag.writeBlocking does update the instance's parameter's value in my case.

Hello Edward, If you were wanting to edit the UDT definition itself, I would suggest using system.tag.configure(). There's a pretty good example near the bottom of the User Manual below. See the Python - Writing to Parameters in UDT Definition section

1 Like

Closing this thread due to me making a coding error.
The UDT parameter is a String.
I forgot I'd overridden it to an Integer in the Instance.
No wonder the write wouldn't work.
Apologies for wasting your time.