Copy tag values of UDT instance to another

Hello,

I have multiple tag instances of the same UDT that I have created, and I would like to copy all of the tag values(200 or so) from one instance to another. Is there any feature that exists in that can accomplish this? Or is there a way to have a script loop through all the tags contained in a UDT?

I have around 200 instances of my UDT and I want to be able to write the tag values of each into a holding UDT. I want to have a transaction group set up for my holding UDT so I can store the data from the one I am writing from in the database. Each of the instances are machine recipe parameters, and on good days, I want to store them as a reference. I thought this way sounded better than creating 200 transaction groups :slight_smile:

Thanks!

You don’t need to use transaction groups (I’ve never used them tbh) , you could just script the sql insert into your database? Could trigger this on tag change script in your UDT or just via a button press action
1% battery… Otherwise would reply more

I wanted to use the transaction group because it does all the heavy lifting(creating a table with 200+ columns for each of the tags in my UDT). I am not opposed to using a sql insert script, but I would like a way to loop through all 200 tags in my UDT instead of tieing them line by line to the db columns. I can trigger this off a button press as I don’t want to create records of these recipes all the time, its more of a safety net and reference.

Is there a way to loop through all tags in a multi-folder udt?

Thanks!

You can use system.tag.browse to find all of your tags. This will also grab the current values of them as well. For subfolders also make sure to use recursive.
Eg

udtTagPath = 'path/to/udtinst' 
tags = system.tag.browse(path=udtTagPath, filter={'recursive': True, 'tagType': 'AtomicTag'}) 
for tag in tags:
    print tag['fullPath'], tag['value'].value

Thank you very much! I will give this a shot.