Passing data into a Tag

Hi there,

I am new to ignition so please bear with me!
I have created a UDT tag called pump and in that tag I have 3 integers which connect to the PLC via OPC. The three values makeup the data that is associated with my pump. So far so good. Now I want to make the OPC path dynamic so that if my OPC path changes I just modify the address in one place and all the tags change. But I can’t seem to be able to point a parameter of my UDT at an existing tag, in this case my default tag would be a string containing the address of the OPC server and the instances of my UDT’s would then reference this address.

I hope that makes sense and thanks for your help.

You need to parameterize your UDT tag paths.
Start here for 7.9.x
https://docs.inductiveautomation.com/display/DOC79/Creating+UDT+Definition
https://inductiveuniversity.com/videos/creating-udt-definition/7.9
Or here for 8.x
https://docs.inductiveautomation.com/display/DOC80/UDT+Definitions#UDTDefinitions-AddingParameters
https://inductiveuniversity.com/videos/creating-udt-definitions/8.0

Hi there,

Thanks for your reply. I have seen the links that you pasted but I’m not sure these help me. I can put a parameter into the OPC server path no problem but when I create an instance of the UDT I can only type text into the parameter value (i.e. hard code it). I want the value in the parameter to come from another tag but I can’t seem to do that.
I want to store the address of the OPC server in one tag on the system and if I change that tag value then all the UDT OPC server addresses referencing that tag change.

Another option I thought of was that rather than using a parameter I can create another tag inside the UDT which is a reference tag. I can then pick up the address of the OPC server (by referencing a global tag) but how do I pass the value of this tag inside the UDT to another tag as the OPC server address inside a UDT.

Thanks in advance
Kevin Lee

Not sure you can do what you want purely with expressions. You may have to script it with system.tag.edit* or system.tag.configure*.

Hi there,

Thanks for your response. I haven’t looked at that kind of scripting yet. Is there anywhere I can read up on the commands you are talking about and see whereabouts I would add such a script?

I also assume that I would need to have a line of script for each device to change or would it be possible to pick up a collection of tags. So the script would be from 1 to numb of tags in a collection rather than explicitly coding each tag.

Kind Regards
Kevin

https://docs.inductiveautomation.com/display/DOC80/system.tag

https://docs.inductiveautomation.com/display/DOC80/Gateway+Event+Scripts#GatewayEventScripts-TagChangeScripts