Move tag by script

Hi all
is there a way to move a tag by using script? I have to move a tag from a folder called “temp” to the main folder
Thank you

There’s no way to move a tag - you can only remove it and re-create it in the new location.

ok. So the solution I am using now is the only one that is possible. Thank you for the reply

You can get this functionality using system.tag.browseConfiguration and system.tag.configure.

Here is a very hard coded example. It might be easier to convert the TagConfigSet to JSON and deal with it that way, but this works for your example.

t = system.tag.browseConfiguration("temp",True)
print t[0].properties

for p in t[0].properties:
	if p.name == "path":
		break
	else:
		p = None

op = t[0].fullPath
if p is not None:
	t[0].set(p,"")
	
print t.toJSON()
system.tag.configure(path = "",tags=t,collisionMode = "Abort")
system.tag.removeTag(op)
1 Like

Thank you Kyle but that script is not working as expected as the tag I have to move is an UDT instance. So if I run this script it will take just the first tag inside the instance and move it to the main folder

It will work, just move the udt itself, by changing its path.