# Read from A OPC device, write value to B OPC device/PLC

**URL:** <https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325>\
**Category:** Ignition\
**Created:** [July 28, 2021, 8:17pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325 "2021-07-28T20:17:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![stuart.williams](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stuart.williams/32/42310_2.png) [@stuart.williams](https://forum.inductiveautomation.com/u/stuart.williams)\
**Post date:** [July 28, 2021, 8:17pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/1 "2021-07-28T20:17:17Z")

</div>

Hi everyone,

I’ve got a customer that wants to use Ignition as a middleware between OPC systems (A device and B device) on a production line. Ignition is to read values from OPC device A and then write changes into a PLC or other OPC device.

My first thought was just to have tag event change scripts on the tags to write whenever a change was registered. My only concern is that there will be a lot of tags being managed all at the same time. For instance, a device could have hundreds of tags and there could be upwards of 25 opc devices that need this functionality.

I didn’t find anything in the forums, and just wanted to check to see if there was a more tried and true method of achieving what I want, or if there is a more reliable method than just thousands of tag change scripts.

Thanks,  
Stuart

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [July 28, 2021, 8:54pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/2 "2021-07-28T20:54:03Z")

</div>

OPC to OPC transaction group?

[https://docs.inductiveautomation.com/display/DOC81/OPC+to+OPC+Transaction+Group](https://docs.inductiveautomation.com/display/DOC81/OPC+to+OPC+Transaction+Group)

Tag change scripts would probably be fine, too, though…

---

<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 28, 2021, 9:29pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/3 "2021-07-28T21:29:58Z")

</div>

I would use a single gateway tag change script subscribed to all of the “origin” OPC tags. Place all of those in folder named “Origin”, with subfolders as desired. For each of those, make the corresponding (receiving) OPC tag with the same name and subfolder within a top level “Target” folder. In the tag script, remove the “Origin” prefix and add the “Target” prefix to obtain the target tag path to write the new value to.

As an optimization, when the initialChange flag is true, I would read the target tag and only write the new value if different.

---

<div class="post-metadata">

**Author:** ![stuart.williams](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stuart.williams/32/42310_2.png) [@stuart.williams](https://forum.inductiveautomation.com/u/stuart.williams)\
**Post date:** [July 29, 2021, 1:32pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/4 "2021-07-29T13:32:14Z")

</div>

I was curious if transaction groups could be used for this, but I missed the OPC to OPC example when doing my research. Thanks for providing the link.

---

<div class="post-metadata">

**Author:** ![stuart.williams](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stuart.williams/32/42310_2.png) [@stuart.williams](https://forum.inductiveautomation.com/u/stuart.williams)\
**Post date:** [July 29, 2021, 1:33pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/5 "2021-07-29T13:33:00Z")

</div>

Thank you for your proposed solution. I’ll look into this on our side.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [July 29, 2021, 2:07pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/6 "2021-07-29T14:07:50Z")

</div>

Won't putting all the source tagpaths in the gateway tag change script tag list and writing a script to write them to appropriate tag name generated thru script, in destination PLC tag paths work? Only thing is that we have to manually list all tag paths from the 'source' PLCs tags in the script. Of course initial change flag has to be used appropriately. This is how I am using to communicate in my new module.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [July 29, 2021, 3:02pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/7 "2021-07-29T15:02:21Z")

</div>

> [@prafull\_j](#):
>
> we have to manually list all tag paths from the ‘source’ PLCs tags in the script.

Aren't wildcards supported here now?

---

<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 29, 2021, 3:30pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/8 "2021-07-29T15:30:35Z")

</div>

Minimally supported. Only for leaf nodes in a folder, IIRC.

---

<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 29, 2021, 3:31pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/9 "2021-07-29T15:31:23Z")

</div>

> [@prafull\_j](#):
>
> Won’t putting all the source tagpaths in the gateway tag change script tag list and writing a script to write them to appropriate tag name generated thru script, in destination PLC tag paths work?

I think you just restated my recommendation.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [July 29, 2021, 4:12pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/10 "2021-07-29T16:12:23Z")

</div>

Yes I guess that will help in case of bulk of tags under a folder or tags are having a pattern.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [July 29, 2021, 4:15pm UTC](https://forum.inductiveautomation.com/t/read-from-a-opc-device-write-value-to-b-opc-device-plc/49325/11 "2021-07-29T16:15:21Z")

</div>

All three approaches are valid, each has its pluses and minuses. One has to choose based on his convenience.
