# Value Changed script doesn't execute

**URL:** <https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [April 14, 2023, 6:27pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473 "2023-04-14T18:27:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [April 14, 2023, 6:27pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/1 "2023-04-14T18:27:54Z")

</div>

8.1.22

I have a tag event script. I have the tag set to change every 30 sec if(dateExtract(Now(1000),"second")\<30,1,0)

that part is working and tag is changing value  
I have tag change script below.  
If I copy either section to script console and execute it runs and does what it is supposed to do but it never executes from the tag value change.

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

---

<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:** [April 14, 2023, 6:30pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/2 "2023-04-14T18:30:00Z")

</div>

What project is the named query defined in? What is the Gateway Scripting Project set to?

---

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [April 14, 2023, 6:32pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/3 "2023-04-14T18:32:15Z")

</div>

ahh i see that now. need to add project name to namedquery reference

---

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [April 14, 2023, 6:36pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/4 "2023-04-14T18:36:09Z")

</div>

system.db.runNamedQuery("ProjectName", "folderName/myNamedQuery")

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 16, 2023, 12:19am UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/5 "2023-04-16T00:19:10Z")

</div>

Ps it's _far_ more efficient to read all of those tags in one call:

```auto
a, b, c = [qval.value for qval in system.tag.readBlocking([taga, tagb, tagc])] 

```

---

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [April 17, 2023, 6:43pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/6 "2023-04-17T18:43:16Z")

</div>

> [@rfolkes](#):
>
> /myNamedQuery")

Thanks,

Does that work better for the tag.write as well?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 17, 2023, 8:59pm UTC](https://forum.inductiveautomation.com/t/value-changed-script-doesnt-execute/72473/7 "2023-04-17T20:59:20Z")

</div>

Yep
