# View doesn't update when tag changes (script with two variables)

**URL:** <https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 15, 2025, 5:48pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482 "2025-10-15T17:48:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastiaan](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Sebastiaan](https://forum.inductiveautomation.com/u/Sebastiaan)\
**Post date:** [October 15, 2025, 5:48pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/1 "2025-10-15T17:48:52Z")

</div>

Hello, I have a charging station with two charging points. Each charging point has its own udt in the tag browser with a charging status. I have created a view that visualises the status of the charging station (one large square and a line). These change colour together when one of the charging points is in use or both (status A1 or A2), in which case I colour them green. Why: because people plug in to the wrong socket sometimes (yeah i know). When both of them are NOT in use i color them white (free). I have written a script for this. My question is: I can only link the script to one udt, so if the charging point changes from status, my script is not executed and the color doenst change. How can I ensure that my script is executed the statuses in both udts change?

 ![Parking](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/a/ba9dfc996b4c904946e976f4ec51ced9dff8e74e.png)

 ![Script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/c/4ccca8e3b1d4c1b42f6c1d90814be98ae24e8034.png)

 ![udt](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/c/6c85fbaf93547ee7f1954475dd972bb0fc5b0eb6.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 15, 2025, 5:53pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/2 "2025-10-15T17:53:07Z")

</div>

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).  
Anyone wanting to test or modify your code would have to type it all out again.

---

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [October 15, 2025, 5:54pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/3 "2025-10-15T17:54:12Z")

</div>

it seems like you are trying to bind a property using an indirect tag. Use the property binding, that should fix your issue

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 15, 2025, 5:55pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/4 "2025-10-15T17:55:37Z")

</div>

Make 2 custom internal template properties, and add indirect bindings to bind them to the desired udt tags/members. Make an expression binding on the label that references those two internal template properties to return the desired color for the background.

---

<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:** [October 15, 2025, 5:56pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/5 "2025-10-15T17:56:21Z")

</div>

You are using readBlocking() in a script. You will only get values for the corresponding tags when the script runs. The script will only run when your tag path changes.

You should add view custom properties that receive these tag values via indirect tag binding. Those properties will then be "live" instead of snapshotted at view startup.

Make a suitable expression binding to compute the coloring from the propery values, not from any readBlocking calls.

---

<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:** [October 15, 2025, 6:02pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/6 "2025-10-15T18:02:22Z")

</div>

Rephrased a third time, to make the point extra explicit:

**Don't use scripting if you don't have to**.

Prefer direct bindings when possible. If you must use a transform, prefer 'native' transform types, followed by expression transforms, only using script transforms as a 'last resort' where their expressiveness is truly required.

In this case, two custom properties with indirect tag bindings and a third with an expression binding is the way to go. It's easier to maintain, less code to go wrong, and **significantly** more performant.

If you _must_ write a script transform:

1. **Do not** read or write anything outside of your transform scope. Use an expression structure binding if you need to deliver additional values into your transform, rather than running a blocking operation like a tag read or database write in the transform. Do not use any side effects to operate to anything else - only use the `return` value as output.
2. Never `import system` (or anything from your project library) - it's unnecessary and can lead to other issues.

---

<div class="post-metadata">

**Author:** ![Sebastiaan](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Sebastiaan](https://forum.inductiveautomation.com/u/Sebastiaan)\
**Post date:** [October 15, 2025, 6:26pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/7 "2025-10-15T18:26:43Z")

</div>

Thank you for this clarification. I have replaced my script with an expression for this case, and it works. Could you tell me how I can read two or more variables with updates via a script, in case this should ever be necessary in the future? Could you possibly demonstrate this with this example, even though it is NOT the correct method?

---

<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:** [October 15, 2025, 6:34pm UTC](https://forum.inductiveautomation.com/t/view-doesnt-update-when-tag-changes-script-with-two-variables/111482/8 "2025-10-15T18:34:06Z")

</div>

You simply cannot. Essentially all scripts in Ignition are event driven - they are run at a particular time by some mechanism out of your direct control. There's no way to set up a "watch" for another tag, especially not within your example here of a transform.

The only way to 'watch' multiple tags is to set up bindings, because 'under the hood' those bindings set up subscriptions to automatically monitor the tags for value changes. If you want to do what you were doing within a binding with no intermediate custom properties, then the way to do that would be an expressions structure binding. You could set up two outer expressions using the `tag` function, and then use subscripting inside the script transform to get the values at the time the transform was reevaluated. No system function would be required.

However, before Phil gets my goat -

1. Don't use the `tag` expression function in an UI related context. Pretend it doesn't exist.
2. There's no good reason to avoid custom properties and prefer scripting here.
