Writing to a PLC tag from a client event script

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!

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.

You forgot to read the tags you are adding.

writeBlocking doesn't exist in 7.9, but writeAll does: system.tag.writeAll - Ignition User Manual 7.9 - Ignition Documentation

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

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.

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

2 Likes

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.

2 Likes