# Passing data into a Tag

**URL:** <https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975>\
**Category:** Ignition\
**Created:** [April 16, 2020, 11:22am UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975 "2020-04-16T11:22:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Lee](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@Kevin\_Lee](https://forum.inductiveautomation.com/u/Kevin_Lee)\
**Post date:** [April 16, 2020, 11:22am UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975/1 "2020-04-16T11:22:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [April 16, 2020, 8:17pm UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975/2 "2020-04-16T20:17:36Z")

</div>

You need to parameterize your UDT tag paths.  
Start here for 7.9.x  
[https://docs.inductiveautomation.com/display/DOC79/Creating+UDT+Definition](https://docs.inductiveautomation.com/display/DOC79/Creating+UDT+Definition)  
[https://inductiveuniversity.com/videos/creating-udt-definition/7.9](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://docs.inductiveautomation.com/display/DOC80/UDT+Definitions#UDTDefinitions-AddingParameters)  
[https://inductiveuniversity.com/videos/creating-udt-definitions/8.0](https://inductiveuniversity.com/videos/creating-udt-definitions/8.0)

---

<div class="post-metadata">

**Author:** ![Kevin\_Lee](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@Kevin\_Lee](https://forum.inductiveautomation.com/u/Kevin_Lee)\
**Post date:** [April 17, 2020, 7:13am UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975/3 "2020-04-17T07:13:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 17, 2020, 11:33am UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975/4 "2020-04-17T11:33:13Z")

</div>

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*`.

---

<div class="post-metadata">

**Author:** ![Kevin\_Lee](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@Kevin\_Lee](https://forum.inductiveautomation.com/u/Kevin_Lee)\
**Post date:** [April 17, 2020, 11:53am UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975/5 "2020-04-17T11:53:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 17, 2020, 12:00pm UTC](https://forum.inductiveautomation.com/t/passing-data-into-a-tag/33975/6 "2020-04-17T12:00:53Z")

</div>

> [@Kevin\_Lee](#):
>
> Is there anywhere I can read up on the commands you are talking about

[https://docs.inductiveautomation.com/display/DOC80/system.tag](https://docs.inductiveautomation.com/display/DOC80/system.tag)

> [@Kevin\_Lee](#):
>
> would it be possible to pick up a collection of tags

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