Gateway Event Executes But Nothing Happens

if initialChange == 1:
	Camera_Offset_Dataset ="[default]PEM Tags/Camera Offset History").value
	X ="[default]PEM Tags/X").value
	Y ="[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")"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.

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

1 Like

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


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.

1 Like