# Tag.write vs opc.write

**URL:** <https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [August 10, 2023, 2:28pm UTC](https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696 "2023-08-10T14:28:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Urvish\_Mehta](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/urvish_mehta/32/81912_2.png) [@Urvish\_Mehta](https://forum.inductiveautomation.com/u/Urvish_Mehta)\
**Post date:** [August 10, 2023, 2:28pm UTC](https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696/1 "2023-08-10T14:28:08Z")

</div>

Hello,  
there are two writes for tag. system.tag.write and system.opc.write. Whats the difference? is OPC one faster than tag write? What should be used and why and when.

thanks

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 10, 2023, 2:55pm UTC](https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696/2 "2023-08-10T14:55:55Z")

</div>

They don't both write to tags. `system.tag.write*` does write to tags, of course, but `system.opc.write` writes directly to the OPC server (bypassing the tag system altogether). `system.opc.write` can be used to write to _PLC tags_ that don't have an associated _Ignition tag_.

I wrote `system.tag.write*` because in 8.1 you should use either `system.tag.writeBlocking` or `system.tag.writeAsync`. "Blocking" will pause your script until the write has been accomplished and will return a list of quality codes that you can examine to verify the write was successful. ~~"Async" is fire and forget. The work happens in a separate thread, returns nothing, and your script continues on immediately. I believe that `system.tag.write` (deprecated) works the same as `system.tag.writeBlocking`, but it isn't recommended for new work.~~

Edited for accuracy.

Links that may be helpful:

[https://docs.inductiveautomation.com/display/DOC81/system.opc.writeValues](https://docs.inductiveautomation.com/display/DOC81/system.opc.writeValues)  
[https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking](https://docs.inductiveautomation.com/display/DOC81/system.tag.writeBlocking)  
[https://docs.inductiveautomation.com/display/DOC81/system.tag.writeAsync](https://docs.inductiveautomation.com/display/DOC81/system.tag.writeAsync)

---

<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:** [August 10, 2023, 3:00pm UTC](https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696/3 "2023-08-10T15:00:40Z")

</div>

> [@zacht](#):
>
> I believe that `system.tag.write` (deprecated) works the same as `system.tag.writeBlocking`, but it isn't recommended for new work.

No, the legacy `system.tag.write()` is asynchronous, and provides no opportunity to ever get the write status.

Modern `system.tag.writeAsync()` is **not** fire-and-forget when used with a callback. The callback gets the list of status codes that `writeBlocking()` would have returned. (IIRC, under the hood, `writeBlocking()` is really a `writeAsync()` that waits on the callback.)

The legacy equivalent to `writeBlocking` was `writeSynchronous()`.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [March 8, 2024, 4:46pm UTC](https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696/4 "2024-03-08T16:46:40Z")

</div>

Coming into this thread with a question - both write at the moment of calling correct? I.e. system.tag.writeBlocking does not wait until the next polling opportunity to try to write, it writes the moment it's called correct and the only differences are the ones mentioned above in this thread?

---

<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:** [March 8, 2024, 4:48pm UTC](https://forum.inductiveautomation.com/t/tag-write-vs-opc-write/77696/5 "2024-03-08T16:48:52Z")

</div>

Yes, that's correct.

edit: ish. You can treat it that way, though technically there can be a slight delay that has nothing to do with polling or tag group rates. But since you are blocking and awaiting the result of the write it doesn't matter.
