# Gateway Tag change script - change trigger

**URL:** <https://forum.inductiveautomation.com/t/gateway-tag-change-script-change-trigger/17494>\
**Category:** Ignition\
**Tags:** database, scripting\
**Created:** [March 26, 2018, 1:24pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-change-trigger/17494 "2018-03-26T13:24:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julio.Bautista](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Julio.Bautista](https://forum.inductiveautomation.com/u/Julio.Bautista)\
**Post date:** [March 26, 2018, 1:24pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-change-trigger/17494/1 "2018-03-26T13:24:44Z")

</div>

I have a gateway tag event that is looking at two opc tags and when they both go true I want my script to write to the database to run. Below are screenshot of both my tag event script and shared script

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b2e6875c0b6f8bdacd75393318e045b3a0368dbb.png)

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/760facf60bb8a649353be511165aed5473182bae.png)

I went to my wrapper log on the gateway and realized that my print statements where writing twice which to me indicates that my event script is being called twice and I dont have the slightest idea on why.  
unless its due to both tags being used as my change triggers  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f4260aeb08181e9ae8321d572828a6fafea39240.png)

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [March 26, 2018, 1:30pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-change-trigger/17494/2 "2018-03-26T13:30:53Z")

</div>

If both values change in the same OPC read cycle, it will indeed cause the script to be executed twice (both are true at that point).

A possible solution is to create an expression tag (the “and” of the two other tags), and react on that instead.

---

<div class="post-metadata">

**Author:** ![Julio.Bautista](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Julio.Bautista](https://forum.inductiveautomation.com/u/Julio.Bautista)\
**Post date:** [March 26, 2018, 2:18pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-script-change-trigger/17494/3 "2018-03-26T14:18:27Z")

</div>

I was hoping that putting it in the if statement would neglect that from happening, but I’ll go ahead and do that. Thank you very much.
