# OPC tag definition

**URL:** <https://forum.inductiveautomation.com/t/opc-tag-definition/27617>\
**Category:** Ignition\
**Created:** [August 21, 2019, 3:23am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617 "2019-08-21T03:23:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaoliang](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@chaoliang](https://forum.inductiveautomation.com/u/chaoliang)\
**Post date:** [August 21, 2019, 3:23am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/1 "2019-08-21T03:23:22Z")

</div>

I have ignition setup communicating with rockwell PLC via Rslinx OPC.

in the tag definition, I need to enter the “OPC Server” and “OPC Item Path”.

Currently I need to enter these values either manually or via the parameters in the UDT.

Just wondering whether I can create a new tag folder called “Global” to store the OPC server name and device name. Then I can call these values when defining the OPC tags? So the OPC Item path will become {OPC Server Name}{OPC Device Name}.xxx. These indirect address should be from another tag instead of parameters of the UDT which I am currently using.

So I have a central place to look at or modify if I am switching to another OPC server with a different name later. It will make tag changes much easier.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 22, 2019, 6:53pm UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/2 "2019-08-22T18:53:54Z")

</div>

You didn’t mention what version of Ignition you are using, but UDT’s would fit the bill.

for switching OPC servers, I have successfully used Find/Replace to do this.

---

<div class="post-metadata">

**Author:** ![dawei.liu](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dawei.liu](https://forum.inductiveautomation.com/u/dawei.liu)\
**Post date:** [September 2, 2019, 3:57pm UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/3 "2019-09-02T15:57:33Z")

</div>

@JordanCClark  
I have a similar issue that need to change the OPC Server for a lot of tags dynamically during the runtime.

How could I achive it if not using system.tag.confiugre()?

my version is ignition 8.0.4 nightly.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 3, 2019, 1:39am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/4 "2019-09-03T01:39:01Z")

</div>

If you’re doing it _during runtime_, you must use configure.

---

<div class="post-metadata">

**Author:** ![dawei.liu](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dawei.liu](https://forum.inductiveautomation.com/u/dawei.liu)\
**Post date:** [September 5, 2019, 2:05am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/5 "2019-09-05T02:05:31Z")

</div>

@JordanCClark

Thanks for your info  
The parameters setting is not so convenient as the previous system.tag.editTag.  
The first parameter is basePath, not the tag path itself.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [September 5, 2019, 11:46am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/6 "2019-09-05T11:46:57Z")

</div>

You can use the tag path as the basePath.

```python
tagName = '[default]path/to/tag'

tagConfig = system.tag.getConfiguration(tagName)[0]

tagConfig['opcItemPath'] = 'new_opc_item_path'

system.tag.confiure('', [tagConfig])

```

---

<div class="post-metadata">

**Author:** ![dawei.liu](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@dawei.liu](https://forum.inductiveautomation.com/u/dawei.liu)\
**Post date:** [September 5, 2019, 2:05pm UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/7 "2019-09-05T14:05:00Z")

</div>

@JordanCClark

Thanks for your suggetsion.  
The usage of [0] in system.tag.getConfiguration(tagName) is really useful. 🙂

---

<div class="post-metadata">

**Author:** ![isaias.berhe](https://avatars.discourse-cdn.com/v4/letter/i/e68b1a/32.png) [@isaias.berhe](https://forum.inductiveautomation.com/u/isaias.berhe)\
**Post date:** [March 19, 2020, 12:20am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/8 "2020-03-19T00:20:29Z")

</div>

@JordanCClark i am using 7.9.12 I defined the OPC server name as a parameter in a UDT. However, when i exported instances of the UDT, I do not see any reference of the opc server parameter. Because of that, i can’t do find and replace for bulk changes. Any thoughts on this?

---

<div class="post-metadata">

**Author:** ![mellsberry](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@mellsberry](https://forum.inductiveautomation.com/u/mellsberry)\
**Post date:** [March 22, 2020, 1:44am UTC](https://forum.inductiveautomation.com/t/opc-tag-definition/27617/9 "2020-03-22T01:44:32Z")

</div>

After defining the OPC server name as a UDT parameter, you need to use while referring to a tag  
Here’s what it looks like for me in Ignition 8.0  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8f1eaaddd9bc7f6a31fac43042455d736ab8fb97.png)

Then you can read the tag configuration from the one you changed and change the rest via a script that Jordan recommended.
