# Run a tag query after a tag change of state

**URL:** <https://forum.inductiveautomation.com/t/run-a-tag-query-after-a-tag-change-of-state/48588>\
**Category:** Ignition\
**Created:** [July 7, 2021, 7:42pm UTC](https://forum.inductiveautomation.com/t/run-a-tag-query-after-a-tag-change-of-state/48588 "2021-07-07T19:42:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric.avila](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@eric.avila](https://forum.inductiveautomation.com/u/eric.avila)\
**Post date:** [July 7, 2021, 7:42pm UTC](https://forum.inductiveautomation.com/t/run-a-tag-query-after-a-tag-change-of-state/48588/1 "2021-07-07T19:42:50Z")

</div>

Hi

I try to make a query after a tag in a plc change of value of 1 to 0.  
I have the query and work fine, but in execution mode don`t exist something like this, exist 3 options but the query always is running, and i don`t want run the query all the time.  
Exist other type to run a query tag?

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [July 7, 2021, 9:33pm UTC](https://forum.inductiveautomation.com/t/run-a-tag-query-after-a-tag-change-of-state/48588/2 "2021-07-07T21:33:33Z")

</div>

I don’t know where you’re trying to do this, but you may be able to use a Gateway Tag Change Event Script.  
In the Gateway Event Scripts section select Tag Change. You can add a script that will execute each time the tag changes. If you only want to run your query (in script form) after the tag value transitions to 0 you can filter based on the current value.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/2/024bd4e4dca6d7c2ff01bb338d398bbdaffd81cb.png)

[Gateway Event Scripts - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Gateway+Event+Scripts#GatewayEventScripts-TagChangeScripts) may also be helpful if you decide to use this method.

---

<div class="post-metadata">

**Author:** ![eric.avila](https://avatars.discourse-cdn.com/v4/letter/e/c77e96/32.png) [@eric.avila](https://forum.inductiveautomation.com/u/eric.avila)\
**Post date:** [July 15, 2021, 8:18pm UTC](https://forum.inductiveautomation.com/t/run-a-tag-query-after-a-tag-change-of-state/48588/3 "2021-07-15T20:18:50Z")

</div>

Yes this will really help to solve my problem.

thanks
