# Writing to a PLC tag from a client event script

**URL:** <https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [July 26, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952 "2023-07-26T16:10:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Puente](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Joseph\_Puente](https://forum.inductiveautomation.com/u/Joseph_Puente)\
**Post date:** [July 26, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/1 "2023-07-26T16:10:33Z")

</div>

I want to write to a tag in the PLC using a client event script. I have the tag trigger set up and want to write a value, which is the sum of multiple tags, to a specified tag.  
Example:  
system.tag.write("My/Tag/Path\_Total", "Other/tag/path\_Value" + "this/tag/path\_Value" + "that/tag/path\_Value")

but this is not writing to the tag.  
I can insert a value just to test it, and it writes a value to the tag.  
Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [July 26, 2023, 4:18pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/3 "2023-07-26T16:18:09Z")

</div>

Since you are on 7.9 you won't be able to use system.tag.writeBlocking and as far as i know system.tag.write can only do a tag at a time.

---

<div class="post-metadata">

**Author:** ![jay](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jay](https://forum.inductiveautomation.com/u/jay)\
**Post date:** [July 26, 2023, 4:19pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/5 "2023-07-26T16:19:02Z")

</div>

You forgot to read the tags you are adding.

---

<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 26, 2023, 4:19pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/6 "2023-07-26T16:19:49Z")

</div>

`writeBlocking` doesn't exist in 7.9, but `writeAll` does: [system.tag.writeAll - Ignition User Manual 7.9 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC79/system.tag.writeAll)

"Blocking" doesn't refer to a "block" of values, it's blocking vs non-blocking (asynchronous).

---

<div class="post-metadata">

**Author:** ![Joseph\_Puente](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Joseph\_Puente](https://forum.inductiveautomation.com/u/Joseph_Puente)\
**Post date:** [July 26, 2023, 4:22pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/7 "2023-07-26T16:22:08Z")

</div>

I'm wanting to write the sum of the tag values(path\_Value) to one tag (path\_Total). I'm not even sure this is possible.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 26, 2023, 4:24pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/8 "2023-07-26T16:24:43Z")

</div>

You'll have to read the the tags, and do the arithmetic with the returned values.

---

<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 26, 2023, 4:41pm UTC](https://forum.inductiveautomation.com/t/writing-to-a-plc-tag-from-a-client-event-script/76952/9 "2023-07-26T16:41:04Z")

</div>

> [@Joseph\_Puente](#):
>
> `"Other/tag/path_Value" + "this/tag/path_Value" + "that/tag/path_Value"`

This just concatenates these three strings. Jython has no idea that these string are the names of tags.

To get the tag values, you need to use one of the `system.tag.read*` functions. Read the docs carefully, because these functions do not return the actual tag value directly, but return a combination object that contains `.quality`, `.timestamp`, and `.value` properties.
