Search and Replace with UDT parameters

I imported a project and need to change the name of the PLC connection. I did a search and replace on the PLC name and changed all the references to the device name. However, the search and replace will not allow me to change the PLC name in the parameters of a UDT. Does anyone know how to get the search and replace to replace the parameter in the UDT? Otherwise I have to go through each UDT separately. ;-(

I could be very wrong. But when I open the search and replace it doesn’t say it checks params in UDTs. So I don’t think that is possible. I just tried, and was able to track it in the instances, but not in the UDT definition.

There might be a way to script it. But I’d have to dig through the java docs to verify, as i’m still trying to soak that all up.

How many UDTs do you have?

I had about 300 UDT’s. I just went through them manually and made the change.

@bwhite assuming you are talking about changing the parameters on the UDT instances, you’d read them like this and then based on whatever change you needed, build a list of write values and write back to the same read paths but with your new desired values:

ext = "/Parameters.plcName"
browse = system.tag.browse("[BNV6094_2]WynrightNew")
readPaths = [str(tag["fullPath"])+ext for tag in browse if "ACL" in tag["typeId"]]
vals = [tag.value for tag in system.tag.readBlocking(readPaths)]

I know its too late and you’ve already done then manually but hopefully it can help if this comes up again in the future.



1 Like

Thank you. I will keep this for future reference!