# Tag value change event

**URL:** <https://forum.inductiveautomation.com/t/tag-value-change-event/74998>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 14, 2023, 7:19am UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998 "2023-06-14T07:19:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deng\_Hayden](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Deng\_Hayden](https://forum.inductiveautomation.com/u/Deng_Hayden)\
**Post date:** [June 14, 2023, 7:19am UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/1 "2023-06-14T07:19:43Z")

</div>

what is the difference of value change event in tag editor and gateway event scripts?  
I see this event in both places, how should I choose and what are their application scenarios?

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [June 14, 2023, 7:33am UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/2 "2023-06-14T07:33:28Z")

</div>

Gateway tag change events will fire if any of the listed tags change. In some projects we use this to begin some shutdown processes if certain alarms tags occur, or for API calls when some of our devices are used.

Tag change events on each tag will only occur if that tags changes, you can also trigger scripts if an alarm becomes active. I've used this in the past to fire some named queries, API calls or if more complex calculations need to occur, we can start that calculation each time a reading changes (though if the calcs are simple you should probably use an expression tag).

Depends how many you use, if you want tag change bound to a tag in a UDT you use a lot, use them on the tag, as then don't need to copy and paste lots of gateway events. Special change events where only one will ever be needed can be done on gateway.

---

<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:** [June 14, 2023, 8:51am UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/3 "2023-06-14T08:51:50Z")

</div>

Keep in mind that tag value change events only have a limited queue of change events. If this fills up due to either slow running event handler code or sufficiently quick value changes, then events may be missed. Gateway events do not suffer from this. Keep your tag value change scripts extremely fast

---

<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:** [June 14, 2023, 12:24pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/4 "2023-06-14T12:24:02Z")

</div>

> [@nminchin](#):
>
> Keep your tag value change scripts extremely fast

This. Events on tags themselves should run in single digit milliseconds or less, due to the likelihood of blocking the system-wide thread pool for tags. That means **no database operations** nor any **network access operations** nor any **recursive searches** in these events.

Gateway tag change events in a project have their own (unbounded) queues and their own threads. Put any time-consuming operations there. But do note that only one thread services all the tags for a given event, so there can be more latency.

---

<div class="post-metadata">

**Author:** ![Deng\_Hayden](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Deng\_Hayden](https://forum.inductiveautomation.com/u/Deng_Hayden)\
**Post date:** [June 15, 2023, 6:49am UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/6 "2023-06-15T06:49:05Z")

</div>

So,the limited queue of change events is shared for all tag?

---

<div class="post-metadata">

**Author:** ![Deng\_Hayden](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Deng\_Hayden](https://forum.inductiveautomation.com/u/Deng_Hayden)\
**Post date:** [June 15, 2023, 6:53am UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/7 "2023-06-15T06:53:15Z")

</div>

> [@pturmel](#):
>
> Gateway tag change events in a project have their own (unbounded) queues and their own threads. Put any time-consuming operations there. But do note that only one thread services all the tags for a given event, so there can be more latency.

Thank you, the information you gave is very critical

---

<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:** [June 15, 2023, 12:01pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/8 "2023-06-15T12:01:29Z")

</div>

> [@Deng\_Hayden](#):
>
> shared for all tag?

No, each tag has its own event queue (length 5 by default), and its own "Missed Event" tracking. But they all run in the same thread pool (threads = 3 by default), so delays in a small number of tags can block processing in all others.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [June 15, 2023, 12:51pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/9 "2023-06-15T12:51:25Z")

</div>

I guess we can't add a tag in the tag change event list of tags. They have to be statically configured in the tag change event triggered gateway script. Correct me I am wrong, I want to be able to dynamically update this list thru a script. Can we do that?

---

<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:** [June 15, 2023, 12:54pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/10 "2023-06-15T12:54:40Z")

</div>

> [@prafull\_j](#):
>
> Can we do that?

No.

---

<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:** [June 15, 2023, 1:08pm UTC](https://forum.inductiveautomation.com/t/tag-value-change-event/74998/11 "2023-06-15T13:08:49Z")

</div>

@Deng_Hayden

You should review this related topic (in its entirety) for some further options:

> [@Check DB vs tag values, run update if different or](https://forum.inductiveautomation.com/t/check-db-vs-tag-values-run-update-if-different-or/75027/2):
>
> This is a bad idea, you should be using Gateway Tag Change events. There are a couple of methods to do this, if the script is generalized enough you can run the same script for all of the tags and just assign those tags to the tag change event (Gateway Tag Change Events can be triggered by multiple tags). You could also generate a top level list of tags, and at a trigger run the script which does all of the work for all of the tags at once. Reference for why this is a bad idea: [https://doc…](https://docs.inductiveautomation.com/display/DOC81/Gateway+Event+Scripts)
