I would like to update a single tag’s OPC item path with script but find that the new system.tag library no longer has the scripts that I was used to in version 7.
When I run the following script
#Updates the OPC path for the target tags
#project.admin.updateOPCPath
def updateOPCPath(folder):
configs = system.tag.getConfiguration(folder, True)
for tag in configs[0]['tags']:
oldOpcPath = tag['opcItemPath']
newOpcPath = oldOpcPath.replace('[Tunneler][Logix]','ns=1;s=[Tunneler][Logix,type=Boolean]')
tag['opcItemPath'] = newOpcPath
system.tag.configure(folder, configs, "o")
The existing tags inside the folder remain and new tags are created in a sub-folder. What is the preferred way of handling this? I have no problem iterating through each tag and making the change but the scripts available in version 8 pointed me toward changes to all the tags in the folder.