# Value Change script not evaluating

**URL:** <https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715>\
**Category:** Ignition\
**Created:** [December 11, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715 "2024-12-11T21:15:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![EDoepke](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@EDoepke](https://forum.inductiveautomation.com/u/EDoepke)\
**Post date:** [December 11, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715/1 "2024-12-11T21:15:31Z")

</div>

Can anyone shed some light on why this script with these tags is not setting the "Comm\_Cond" tag to True? I ran this exact same script on a VM on my home machine and it worked. Now on my Development server it just does not want evaluate correctly. Screenshot clearly shows Comm\_Cond\_Dly\_Tmr (34) is \> Comm\_Cond\_Dly\_SP (10), but Comm\_Cond is still false. Been banging my head against the wall on this one. The Comm\_Cond\_Dly\_Tmr is an Expression that just calculates seconds difference between Now() and the Comm\_Timestamp.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/ace70959ed8394fc59d3be95171f7728881164c2.jpeg)

---

<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:** [December 11, 2024, 9:17pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715/2 "2024-12-11T21:17:54Z")

</div>

`currentvalue.value` should be `currentValue.value`.

The boolean values shouldn't be strings either, but the tag system may accept and coerce those for you.

---

<div class="post-metadata">

**Author:** ![EDoepke](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@EDoepke](https://forum.inductiveautomation.com/u/EDoepke)\
**Post date:** [December 11, 2024, 9:21pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715/3 "2024-12-11T21:21:17Z")

</div>

Thank you! I just found that the "v" in Value wasn't capitalized (saw message in logger). Once I changed it to currentValue it executes perfectly. Thanks for the quick response.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 11, 2024, 10:07pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715/4 "2024-12-11T22:07:36Z")

</div>

Since this script is in a valueChanged script, then you should be at most limiting the number of blocking calls that you are making. (IMO, this should really be moved to a Gateway Script).

Based on what the script is doing, I believe that you would also want to filter out initial changes.

So I would think that your script would look something like this:

```python
if not initialChange:
    spPath = ['[.]Comm_Cond_Dly_SP']
    almPath = ['[.]Comm_Cond']

    almVal = currentValue.value > system.tag.readBlockign(spPath)[0].value
    systme.tag.writeAsync(almPath,[almVal])

```

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [December 11, 2024, 10:32pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715/5 "2024-12-11T22:32:01Z")

</div>

> [@lrose](#):
>
> (IMO, this should really be moved to a Gateway Script)

Are Gateway Tag Change scripts more efficient? They're certainly not as convenient, since you have to specify a list of tags that they apply to, rather than just applying the script to a UDT that automatically applies to any tag of its type...

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 11, 2024, 10:39pm UTC](https://forum.inductiveautomation.com/t/value-change-script-not-evaluating/99715/6 "2024-12-11T22:39:28Z")

</div>

> [@Ryan\_Deardorff](#):
>
> Are Gateway Tag Change scripts more efficient?

It's not really about efficiency. There are limitations to valueChange scripts that make them unsuitable for many types of scripts (e.g long running tasks, DB Access, etc.).

General recomendation is that valueChange scripts execute in single digit ms.

The main reason for this is that they execute in a limited queue. Each change is by default limited to a 5 event queue, any change after that will be missed.

On top of that valueChange scripts for _all_ tags are run in a limited thread pool which by default has a size of 3. Which means that you can only have 3 valueChange events running at any one time. Having many valueChange scripts which execute at longer times (even in 100's of ms) can cascade and cause missed events.
