# Gateway tag change issue

**URL:** <https://forum.inductiveautomation.com/t/gateway-tag-change-issue/21697>\
**Category:** Ignition\
**Created:** [January 5, 2019, 12:01am UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-issue/21697 "2019-01-05T00:01:29Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [January 5, 2019, 6:32pm UTC](https://forum.inductiveautomation.com/t/gateway-tag-change-issue/21697/4 "2019-01-05T18:32:26Z")

</div>

This thread may be relevant:

> [@Tag Event Script 'Value Changed' firing twice?](http://forum.inductiveautomation.com/t/tag-event-script-value-changed-firing-twice/17709/):
>
> Hey folks, 7.9.7 x64 Java 1.8.0\_144 Windows 7 We have a boolean notification tag from the PLC that, on value change, triggers a SQL query. The script is executing, and the query is correct. The problem I am experiencing is that the script appears to run 2x every time the tag changes. I’ve confirmed that it is only changing one time in the PLC, hoping someone can spot something in my script causing the issue: if not initialChange: DB= "Tank\_Temp" now = system.date.now() t\_stamp = system.…

FYI I just tested the below tag change script using memory tags and couldn't get it to mess up on count regardless of how fast/many times I clicked on the triggering tag value checkbox in designer:

```python
	if currentValue.value and not previousValue.value:
		count = system.tag.read('_Test/var1').value
		tags = ['_Test/var1', tagPath]
		values = [count + 1, False]
		system.tag.writeAll(tags, values)

```

The `not previousValue.value` check ensures this is not triggered by a quality change (doubt that's the issue you're having, but it's possible without this check). You may also want to add `and not initialChange`.

---

_[View the full topic](https://forum.inductiveautomation.com/t/gateway-tag-change-issue/21697)._
