# Writing Tags From 1 PLC to Another

**URL:** <https://forum.inductiveautomation.com/t/writing-tags-from-1-plc-to-another/12344>\
**Category:** Ignition\
**Created:** [November 10, 2016, 5:19pm UTC](https://forum.inductiveautomation.com/t/writing-tags-from-1-plc-to-another/12344 "2016-11-10T17:19:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Csantaw](https://avatars.discourse-cdn.com/v4/letter/c/9de0a6/32.png) [@Csantaw](https://forum.inductiveautomation.com/u/Csantaw)\
**Post date:** [November 10, 2016, 5:19pm UTC](https://forum.inductiveautomation.com/t/writing-tags-from-1-plc-to-another/12344/1 "2016-11-10T17:19:54Z")

</div>

I’ve come up with this script to write 1 OPC tag to another OPC tag using system.tag.writeAll() function. I run this script as a Gateway event script on a tag change. when I execute it my gateway script says it was successful but I don’t get the values written to the tags.

`tags = ["Write_Test/Test_Read_Tags_0_",
"Write_Test/Test_Read_Tags_1_",
"Write_Test/Test_Read_Tags_2_",
"Write_Test/Test_Read_Tags_3_",
"Write_Test/Test_Read_Tags_4_"]
v1 = "Read_Test/Read_Tags_0_"
v2 = "Read_Test/Read_Tags_1_"
v3 = "Read_Test/Read_Tags_2_"
v4 = "Read_Test/Read_Tags_3_"
v5 = "Read_Test/Read_Tags_4_"
Values = [v1, v2, v3, v4, v5]
values = system.tag.writeAll(tags,Values)`

I have also tried the system.tag.write() function with the same result in the gateway script saying successful.

`value = "Write_Test/Test_Read_Tags_0_"
system.tag.write("Read_Test/Read_tag1" ,value)`

am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 10, 2016, 6:15pm UTC](https://forum.inductiveautomation.com/t/writing-tags-from-1-plc-to-another/12344/2 "2016-11-10T18:15:21Z")

</div>

Are you trying to write literal strings to the tags, or the values of other tags?  
In your second example, you’re literally writing the string “Write\_Test/Test\_Read\_Tags\_0\_” to Read\_tag1.  
If you want to read a tag value in order to write it to another tag, you would need to do something like this:

`value = system.tag.read("Write_Test/Test_Read_Tags_0_").value
system.tag.write("Read_Test/Read_tag1" ,value)`

---

<div class="post-metadata">

**Author:** ![Csantaw](https://avatars.discourse-cdn.com/v4/letter/c/9de0a6/32.png) [@Csantaw](https://forum.inductiveautomation.com/u/Csantaw)\
**Post date:** [November 10, 2016, 7:00pm UTC](https://forum.inductiveautomation.com/t/writing-tags-from-1-plc-to-another/12344/3 "2016-11-10T19:00:49Z")

</div>

Thanks PGriffith,

yes I am writing Dint values from a piece of equipment designed to communicate only with a PC to my PLC, back and forth. your script works perfect.

Thanks a bunch.
