[SOLVED] Is there a way to set a variable OPC Server for a regular tag?

Good morning,

I have an OPC tag (several hundred actually) and I’d like to change the OPC server path for all of them. From what I can see I can’t set the OPC Server to a variable though so i have to manually update every tag. I also have to update the OPC item path manually. All in all a big task. Is there an easier way?

See attached picture here:

Thanks for any insight!

Are you doing it once or going to do it often in your program?

If its just once, you could export the tags to XML then do a find and replace to change your server path. Then reimport them.

If your doing it more than once you can use system.tag.getConfiguration and system.tag.configure to do it through scripting.

Another idea if your doing it often is to have the tags set up in UDT’s with a parameter setting your OPC Server. Then you could still use the system.tag.configure but you would just need to update the parameter.

1 Like

I use Studio 5000 Logix Emulate to make programs in the office for projects and eventually have to connect to a PLC in the field. All the tags still exist but I have to change the paths at some point. And sometimes I do this in the opposite way. (Transfer a PLC project to my emulator.)

I was able to export a JSON file like you suggested and find/replace everything. It all seems to be working so thank you!