Gateway tag change script - previous value not available

In tag event scripts, previousValue is available in the valueChanged event function but it doesn’t appear to be available in a gateway event tag change script. Is there a way to get the previous value from there?

Version: 8.0.2

1 Like

Looks like it should be available as event.previousValue. This will return the previous value as a qualified value, if you want just the actual value you can use event.previousValue.value


I was just trying to use your suggestion for comparing the current value and previous value on gateway event script tag change for event. enclosing the my script for your reference and the same it gives an error( that is also enclosed). Please resolve this issue.

My Script:

Tag is of Int4 Datatype

if newValue.getValue() != event.previousValue.value:
        <Some Code>


com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 2, in AttributeError: 'NoneType' object has no attribute 'value'

at org.python.core.Py.AttributeError(

at org.python.core.PyObject.noAttributeError(

at org.python.core.PyObject.__getattr__(

at org.python.pycode._pyx1379.f$0(:67)

at org.python.pycode._pyx1379.call_function()



at org.python.core.Py.runCode(

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(

at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(

at com.inductiveautomation.ignition.common.script.TagChangeScriptExecutor$TagChangeExecutionCallback.execute(

at com.inductiveautomation.ignition.common.script.TagChangeScriptExecutor$TagChangeExecutionCallback.execute(

at com.inductiveautomation.ignition.common.util.SerialExecutionQueue$

at java.util.concurrent.Executors$ Source)

at Source)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$ Source)

at Source)

Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 2, in AttributeError: 'NoneType' object has no attribute 'value'

... 18 common frames omitted

There is no previous value when the initialChange flag is true. Either check this flag or check if previousValue is None before further dereferencing it.

What is a solution when there is not initialChange argument?

I have defined session custom tag (A), and I need to set some other session custom tags in depends on the combination current and previous value of session custom tag (A)? In this case, value change on session tags, there is no argument that I can use for detecting initial change?