# Update another tag using a tag value changed script syntax question

**URL:** <https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [February 17, 2025, 4:18pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439 "2025-02-17T16:18:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2025, 4:18pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/1 "2025-02-17T16:18:56Z")

</div>

I am running Ignition version 8.1.35.

I have two (2) tags in my tag provider:

CurrentTimeSeconds and New Tag

CurrentTimeSeconds updates once per second and is supposed to fire a value changed script by writing its value to another tag my tag provider (New Tag).

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/4/64ecf365934556be962bdd98427e1ac3fa35003b.png)

I'm sure I am missing something simple here but can't figure it out. The picture above shows the value changed script and the two (2) tags on the bottom left.

Any help identifying what I am doing wrong is appreciated.

---

<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:** [February 17, 2025, 4:29pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/2 "2025-02-17T16:29:13Z")

</div>

Log the return value from `writeBlocking()`.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2025, 4:35pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/3 "2025-02-17T16:35:40Z")

</div>

Getting nothing.

This gateway is on a remote computer.

I repeated this experiment locally using Ignition 8.1.39 and I am getting a result (and the change script works).

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/7/0786a1e271ef29087ca1c349c28ce6b7a5a159d0.png)

On the remote computer running 8.1.35 I get nothing in the logs or the change script firing.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/9/09f012ee4412aec55f8075506b0442bc8c6793ee.png)

I am thinking to try a gateway stop / start and see what happens. Thoughts?

---

<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:** [February 17, 2025, 4:37pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/4 "2025-02-17T16:37:34Z")

</div>

After you restart a tag, if there is a problem in a script, you should get a **single** error logged on that gateway. (And it typically says that further errors will be logged at DEBUG level.)

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2025, 4:40pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/5 "2025-02-17T16:40:12Z")

</div>

I restarted the tag on the remote computer running 8.1.35 and no new logs appeared. Last log was received about 10 minutes ago.

This error below has appeared periodically; not sure if related or not. There are a few developers working on this remote computer.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6b2ece466beab26534f1a105a205e6fe4e6dba47.png)

---

<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:** [February 17, 2025, 4:47pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/6 "2025-02-17T16:47:04Z")

</div>

If the gateway has a gateway scripting project defined, consider moving the code to a library script. There, it is easier to wrap all of the logic in a dual-clause `try-except-except` for you to log.

You could also log a constant string just before the `writeBlocking()` to see if that comes through.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2025, 5:02pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/7 "2025-02-17T17:02:05Z")

</div>

Could not get a gateway script work either.

Finally, did a gateway restart and logging started working again and my tag change script works.

This has happened twice (2x) to our team on 8.1.35 [for future reference].

No strange errors besides the one I posted that keeps happening periodically.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2025, 5:03pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/8 "2025-02-17T17:03:56Z")

</div>

Maybe this is happening?

> [@Tag Change Event Not Firing](https://forum.inductiveautomation.com/t/tag-change-event-not-firing/17925/8):
>
> Ah, you probably have one or more events scripts that are tying up the event handling thread pool. Infinite loops or some extra-long task. You should take care that any event script called from either tag events or tag change event scripts executes at least as fast as the scan class of the tags involved. Consider adding logging to all of your event scripts to find any slowpokes.

---

<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:** [February 17, 2025, 5:04pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/9 "2025-02-17T17:04:42Z")

</div>

I just started typing that....

My more modern advice, based on more knowledge, is that tag event scripts (on the tag) should run in single digits milliseconds, no exceptions. That means you cannot use any `system.*` functions that would wait on a database or wait on any network exchange. And never sleep or busy-wait. You cannot use `system.tag.writeBlocking()` on anything but memory tags. You cannot interact with the DB except via `system.db.runSFPrepUpdate()`. You cannot use `system.opc.*` at all. You cannot call out to any web API.

Tag Change Events defined in a project get their own thread, so can do more "bad" things.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 17, 2025, 5:22pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/10 "2025-02-17T17:22:57Z")

</div>

How about `system.tag.readBlocking()`?

---

<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:** [February 17, 2025, 5:24pm UTC](https://forum.inductiveautomation.com/t/update-another-tag-using-a-tag-value-changed-script-syntax-question/102439/11 "2025-02-17T17:24:18Z")

</div>

That one is always fine, as it just retrieves the most recently delivered value, practically instantly.
