UDT parameters writing at runtime (bulk tag editing)

Is there any way to programatically change UDT parameters that belong to UDTs within parent UDTs? I have tried system.tag.editTags but i am pretty sure this has a bug for this specific circumstance based on my testing, and another post on this forum, where someone else has the same problem (I am using 7.9.8 which supposedly fixed the problem, but apparently, didn’t). So I am looking for an alternative way. I am able to (partially) read ExtendedProperties to read UDT parameters, and am trying to find a way to reverse this (i.e write extended properties instead of just reading)

Have you considered adding a Memory tag to your UDT to hold the information you need to read and write at run-time?
I assume that you have expression tags that are using the parameter values but the expressions can be updated to use the value of another tag which is easy to read and write at run-time.

1 Like

Thanks for the reply, yes, I have considered this, but i didn’t want to do the rework, as I have a few places where I am using the UDT Parameters within the UDTs which I will need to change to reference them too, in all my UDTs, but i think this might be the only thing I can do

I understand, I overcommitted tag parameters too so… we wait for version 8.

1 Like

Yes, it’s possible–here’s how you modify ExtendedProperties. I will say, finding this post was not reassuring while grinding out a solution :joy:

from com.inductiveautomation.ignition.common.config import Property, BasicProperty
from java.lang import String


def writeUDTParameter( tag, key, value ):
	propertiesList = system.tag.read( '%s.ExtendedProperties' % tag ).value
	
	propertiesList.set(
		BasicProperty( key, String )
		, value
	)
	
	system.tag.editTag( tagPath=tag, attributes={ 'ExtendedProperties': propertiesList } )

writeUDTParameter( '[default]\Path\to\tag', 'ParameterName', 'Value' )


1 Like

thanks

We’ve always done it using this method and it works as expected.

system.tag.editTags(paths, parameters={"paramName": param_new_value})

1 Like

Yep, i tried this, it works. Thanks for help.