# Value change script on query tag

**URL:** <https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 29, 2025, 11:11am UTC](https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815 "2025-05-29T11:11:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 29, 2025, 11:11am UTC](https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815/1 "2025-05-29T11:11:25Z")

</div>

On a query tag I have the execution rate at 30mins. Even thought the value will always be Dataset[20R x 5C] would the script work?

---

<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:** [May 29, 2025, 11:46am UTC](https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815/2 "2025-05-29T11:46:18Z")

</div>

Probably, as a query returns a "new" dataset even if the contents are the same.

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 29, 2025, 5:42pm UTC](https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815/3 "2025-05-29T17:42:10Z")

</div>

10 4, thank you ill give it a shot. Ill update here in a minute

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [May 30, 2025, 1:39pm UTC](https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815/4 "2025-05-30T13:39:12Z")

</div>

It does in fact, do that.

I used this as a trigger for it.

Maybe will help someone else:

```python
if previousValue.value != currentValue.value:
  'your tag stuff here'

```

---

<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:** [May 30, 2025, 1:45pm UTC](https://forum.inductiveautomation.com/t/value-change-script-on-query-tag/106815/5 "2025-05-30T13:45:11Z")

</div>

> [@mjohnson0238](#):
>
> help someone else

That will throw errors on tag restart, as `previousValue` will be null. Always check `initialChange` first.
