# Is it possible to indirect tag my OPC Server and so that I can change (via a Gateway Event Script) which OPC server I am polling

**URL:** <https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [July 17, 2020, 5:16pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829 "2020-07-17T17:16:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdc5067](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@pdc5067](https://forum.inductiveautomation.com/u/pdc5067)\
**Post date:** [July 17, 2020, 5:16pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829/1 "2020-07-17T17:16:07Z")

</div>

Hello All,

I currently have 2 connection paths to develop my ignition project:

1. I originally used the Ignition OPC-UA Server and connected to my PLC
2. I later used the FactoryTalk Linx Gateway to connect to an Emulated PLC (Studio 5000 Logix Emulate)

I have the connection to both up and running fine. and they both contain exactly the same tags. My reason for doing this is because sometimes I work in the office with a PLC on hand and sometimes I work remotely without a PLC available.

**QUESTION:**  
Basically I would like to switch all of my ignition project tags from using the Ignition OPC-UA Server to using the FactoryTalk Linx Gateway OPC-UA Server at will.

What is currently working:  
I figured I could do this by specifying 2 Data Type Parameters for each of my UDTs: 1 called “ServerName” and 1 called “ns\_number”.

I would then pass in the strings “Ignition OPC-UA Server” and “1” for my respective parameters if I wanted to use the Ignition OPC-UA server OR I would pass in “FactoryTalkLinxServer” and “3” for my respective parameters if using the FactoryTalk Linx Gateway.

This also works fine.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/a/3a9d92d5fd2053c21b958524e49ee48fe2e693f1.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/4/a40030a088b04efda42a61c2622979c989efb7a3.png)

**ISSUE:**  
My issue is that in the Data Type Parameters section, I would like to add a Memory tag into the value section. This way I can write to the memory tag via a Gateway Event Script and change all my tags from 1 OPC Server to another. However, the Data Type Parameter values section does not accept my memory tag.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/5/55eb4248b736c7b7fcc403185da146e4489b58e4.png)

**SOLUTION?**  
Is there a better way to go about this switch?

Odd workaround:  
I could also export the Tag xml file, find and replace all the OPC server and ns\_number instances but this seems hokey.

Thanks!!

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [July 17, 2020, 5:20pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829/2 "2020-07-17T17:20:22Z")

</div>

With ignition 8 you can use some parameter for opcserver and item ans it is possible to write those parameters with a script to change the values

---

<div class="post-metadata">

**Author:** ![pdc5067](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@pdc5067](https://forum.inductiveautomation.com/u/pdc5067)\
**Post date:** [July 17, 2020, 5:22pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829/3 "2020-07-17T17:22:38Z")

</div>

Project Spec requires v7.9.xx in my case. Do you know if this is possible in v7.9.xx?

---

<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:** [July 17, 2020, 6:00pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829/4 "2020-07-17T18:00:28Z")

</div>

Consider just renaming the devices manually.

---

<div class="post-metadata">

**Author:** ![pdc5067](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@pdc5067](https://forum.inductiveautomation.com/u/pdc5067)\
**Post date:** [July 17, 2020, 7:32pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829/5 "2020-07-17T19:32:01Z")

</div>

As in on the Gateway side for the Server names? wouldnt the ns=# still be different? When looking it up, ns stands for name space ID/Index, but Im not sure what the implications are of changing it. Ive always simply copied this portion over when dealing with OPC-UA without much thought.

---

<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:** [July 17, 2020, 8:02pm UTC](https://forum.inductiveautomation.com/t/is-it-possible-to-indirect-tag-my-opc-server-and-so-that-i-can-change-via-a-gateway-event-script-which-opc-server-i-am-polling/36829/6 "2020-07-17T20:02:24Z")

</div>

I’ve yet to see a namespace index other than “1” for the drivers I use.
