Changing the Tag group of tags/Tag group

Hello Team,

   How to change the Tag Group of individual tags or UDT tags with script. I have bunch of tags so need script mechanism for changing it.

Srushti N

Hi Srushti, you can use the system.tag.configure() function, the manual has some great examples that helped me when i first had to do this.
Basically, if you want to edit a whole folder it'll look something like this:

folderPath = '[Handling]Modo'
configs = system.tag.getConfiguration('[Handling]Modo', True)[0]['tags']
for config in configs:
	config['tagGroup'] = 'NewTagGroup'
system.tag.configure(FolderPath, configs)

You can also use the tag read and write functions to directly read and write the tagGroup subproperty of any live tag, which is likely going to be more performant, at scale, than configure().

1 Like