Just wanted to update with the script I created to work around this issue for anyone else who may need it. I just tied it to a button on a “test” screen and hit it when I make new udt(s) with copy/replaced bindings.
Here is the code:
opcItem = 'opcItemPath'
logpaths = list()
logger = system.util.getLogger('FixTagLog') #logger for logging fixed tags
#get udt definitions
udts = system.tag.browse('[default]', filter= {'tagType':'UdtType', 'recursive':'True'})
for udt in udts: #get opc type tags inside udts
opcTags = system.tag.browse(udt['fullPath'], filter= {'tagType':'AtomicTag', 'valueSource':'opc', 'recursive':'True'})
for tag in opcTags:
config = system.tag.getConfiguration(tag['fullPath'])
#get tag config and check for proper binding
if isinstance(config[0][opcItem],(str, unicode)) and '{' in config[0][opcItem]:
#if binding isn't correct, fix it and edit tag
binding = config[0][opcItem]
tagpath = str(config[0]['path']).rsplit('/',1)[0]
config[0][opcItem] = {'bindType':'parameter', 'binding':binding}
editConfig = system.tag.configure(tagpath, config,'o')
if 'Good' in str(editConfig):
logpaths.append(tag['fullPath'])
else:
logpaths.append(editConfig)
if logpaths:
logger.info('Fixed tag binding at paths: %s' %logpaths) #logs tags changed/errors