# Gateway Event Executes But Nothing Happens

**URL:** <https://forum.inductiveautomation.com/t/gateway-event-executes-but-nothing-happens/25067>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [May 16, 2019, 3:38pm UTC](https://forum.inductiveautomation.com/t/gateway-event-executes-but-nothing-happens/25067 "2019-05-16T15:38:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwingert](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@kwingert](https://forum.inductiveautomation.com/u/kwingert)\
**Post date:** [May 16, 2019, 3:38pm UTC](https://forum.inductiveautomation.com/t/gateway-event-executes-but-nothing-happens/25067/1 "2019-05-16T15:38:33Z")

</div>

```auto
if initialChange == 1:
	Camera_Offset_Dataset = system.tag.read("[default]PEM Tags/Camera Offset History").value
	X = system.tag.read("[default]PEM Tags/X").value
	Y = system.tag.read("[default]PEM Tags/Y").value
	if newValue == 1:
		for i in range(18,-1,-1):
			Camera_Offset_Dataset = system.dataset.setValue(Camera_Offset_Dataset,i + 1,Camera_Offset_Dataset.getColumnName(1),Camera_Offset_Dataset.getValueAt(i,1))
			Camera_Offset_Dataset = system.dataset.setValue(Camera_Offset_Dataset,i + 1,Camera_Offset_Dataset.getColumnName(2),Camera_Offset_Dataset.getValueAt(i,2))
		Camera_Offset_Dataset = system.dataset.setValue(Camera_Offset_Dataset,0,Camera_Offset_Dataset.getColumnName(1),X)
		Camera_Offset_Dataset = system.dataset.setValue(Camera_Offset_Dataset,0,Camera_Offset_Dataset.getColumnName(2),Y)
		system.tag.write("[default]PEM Tags/Camera Offset History.value",Camera_Offset_Dataset)
logger = system.util.getLogger("myLogger")
logger.info("Hello, world.")

```

Monitoring a bool and the above script is under Tag Change in Gateway Events. I can see the Last Execution update on the gateway status page, updates after the bool changes like it should. I am not getting the “Hello world” message and my dataset is not changing. I have no new errors in my logs. Running the above script (with if statements set to true) in the script console works correctly.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [May 16, 2019, 4:01pm UTC](https://forum.inductiveautomation.com/t/gateway-event-executes-but-nothing-happens/25067/2 "2019-05-16T16:01:33Z")

</div>

Try changing to  
`if not initialChange:`  
and  
`if newValue.value:`

---

<div class="post-metadata">

**Author:** ![kwingert](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@kwingert](https://forum.inductiveautomation.com/u/kwingert)\
**Post date:** [May 16, 2019, 4:43pm UTC](https://forum.inductiveautomation.com/t/gateway-event-executes-but-nothing-happens/25067/3 "2019-05-16T16:43:45Z")

</div>

So that worked. Am I not able to compare a bool to 1 and have it treat the 1 as true?

Thanks

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [May 16, 2019, 4:46pm UTC](https://forum.inductiveautomation.com/t/gateway-event-executes-but-nothing-happens/25067/4 "2019-05-16T16:46:43Z")

</div>

newValue is an object with value, timestamp and quality. You were comparing it to 1.  
But yes you can compare newValue.value == 1  
On your initialChange line, it was only executing once when it first subscribed.
