# currentValue.value and previousValue.value not working

**URL:** <https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130>\
**Category:** Ignition\
**Created:** [August 18, 2022, 4:45am UTC](https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130 "2022-08-18T04:45:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [August 18, 2022, 4:45am UTC](https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130/1 "2022-08-18T04:45:52Z")

</div>

Hi,

I have written a Value changed script for a memory tag in which i used below condition,  
if ( previousValue.value != currentValue.value and currentValue.value == 1 ):  
it worked for earlier days, now i found out that it is not working anymore. So i changed it as  
vCheck =system.tag.readBlocking(“[.]DBDataStoreTriggerHr”)[0].value  
if (vCheck== 1 ):

What might be the root cause of this issue.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![hayden](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hayden](https://forum.inductiveautomation.com/u/hayden)\
**Post date:** [August 18, 2022, 6:03am UTC](https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130/2 "2022-08-18T06:03:32Z")

</div>

what do you mean not working, is it causing an error or the logic not working?

I generally prefer to seperate it using more brackets to make sure the logic is what I want so:

```auto
if ((previousValue.value != currentValue.value) and (currentValue.value == 1)):
     ....

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 18, 2022, 12:23pm UTC](https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130/3 "2022-08-18T12:23:03Z")

</div>

What error do you get in the gateway log?

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [August 19, 2022, 4:44am UTC](https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130/4 "2022-08-19T04:44:52Z")

</div>

Hi,

Logic is not working. When i tried to print the previous or current value in the log. It is not printing at all.

---

<div class="post-metadata">

**Author:** ![hayden](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hayden](https://forum.inductiveautomation.com/u/hayden)\
**Post date:** [August 19, 2022, 5:24am UTC](https://forum.inductiveautomation.com/t/currentvalue-value-and-previousvalue-value-not-working/63130/5 "2022-08-19T05:24:45Z")

</div>

I would try making some memory tags and writing values to those as a test, try changing the value and check those memory tags. If nothing changes then your script isn’t compiling, probably because of an error
