# valueChanged error

**URL:** <https://forum.inductiveautomation.com/t/valuechanged-error/26464>\
**Category:** Ignition\
**Created:** [July 11, 2019, 6:52am UTC](https://forum.inductiveautomation.com/t/valuechanged-error/26464 "2019-07-11T06:52:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgfgreaves](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@tgfgreaves](https://forum.inductiveautomation.com/u/tgfgreaves)\
**Post date:** [July 11, 2019, 6:52am UTC](https://forum.inductiveautomation.com/t/valuechanged-error/26464/1 "2019-07-11T06:52:06Z")

</div>

Trying to create a valueChanged script with a numeric entry field. Any guidance would be greatly appreciated.

code:  
‘’’  
import string  
x = previousValue.value  
y = currentValue.value  
if self.view.custom.PM.ewonType == 1:  
if x != y:  
server = “AWS Mosquitto”  
topic = self.session.custom.Location[0].countryName+"/"+self.session.custom.Location[0].stateName+"/"+str(self.view.custom.PM.depotID)+"/"+self.view.params.id+"/Screw Speed"

```
		param = str(self.props.value)
		payload = param.encode()
		
		system.cirruslink.engine.publish(server, topic, payload, 0,0)

```

‘’  
i am receiving the below error:

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File “”, line 3, in valueChanged AttributeError: ‘NoneType’ object has no attribute ‘value’

at org.python.core.Py.AttributeError(Py.java:207)

at org.python.core.PyObject.noAttributeError(PyObject.java:1032)

at org.python.core.PyObject. **getattr** (PyObject.java:1027)

at org.python.pycode.\_pyx5770.valueChanged$1(:15)

at org.python.pycode.\_pyx5770.call\_function()

at org.python.core.PyTableCode.call(PyTableCode.java:171)

at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

at org.python.core.PyFunction.function\_\_\_call\_\_(PyFunction.java:471)

at org.python.core.PyFunction. **call** (PyFunction.java:466)

at org.python.core.PyFunction. **call** (PyFunction.java:456)

at org.python.core.PyFunction. **call** (PyFunction.java:451)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:776)

at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:894)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:574)

at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:87)

at com.inductiveautomation.perspective.gateway.model.PropertyChangeScript.onValueChanged(PropertyChangeScript.java:102)

at com.inductiveautomation.perspective.gateway.property.PropertyTree$Notifier.run(PropertyTree.java:175)

at com.inductiveautomation.ignition.common.util.ExecutionQueue$PollAndExecute.run(ExecutionQueue.java:232)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

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

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.python.core.PyException: Traceback (most recent call last): File “”, line 3, in valueChanged AttributeError: ‘NoneType’ object has no attribute ‘value’

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [July 11, 2019, 3:07pm UTC](https://forum.inductiveautomation.com/t/valuechanged-error/26464/2 "2019-07-11T15:07:13Z")

</div>

> [@tgfgreaves](#):
>
> y = currentValue.value

This is the line the error is flagging, and the error is basically saying `currentValue` isn't defined (or has a null value)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 11, 2019, 3:22pm UTC](https://forum.inductiveautomation.com/t/valuechanged-error/26464/3 "2019-07-11T15:22:54Z")

</div>

```auto
x = previousValue.value

```

is actually the true failure line due to line “1” of the script consisting of the script `def` line.  
 ![45%20AM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/feeb7ab9103dcf331546709b5537933e3439f0c7.png)  
Your Numeric Entry Field component has no value to start, even though the component itself displays `0`.  
 ![51%20AM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/48f0ba93a1954897a31e6ab1e06cb58ff5e788ca.png)  
If you supply an initial value for the Numeric Entry Field, then the script evaluation error will no longer appear.
