# \[Solved\] "On Change" Logic

**URL:** https://forums.losant.com/t/solved-on-change-logic/282
**Category:** Help
**Created:** [October 31, 2016, 4:21pm UTC](https://forums.losant.com/t/solved-on-change-logic/282 "2016-10-31T16:21:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Bob\_Gelety](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Bob\_Gelety](https://forums.losant.com/u/Bob_Gelety)
#### Post date: [October 31, 2016, 4:21pm UTC](https://forums.losant.com/t/solved-on-change-logic/282/1 "2016-10-31T16:21:02Z")

</div>

I am trying to use the On Change logic to make a determination if a value has toggled between 1 or 0. I am using two nodes one for an “Increase of at least” and another for “Decrease of at least”. I do not seem to be able to make this work using 1 as the value (or even 0.5) to catch the change from 1 to 0 or back.

It seems as if I have a 0 for any of the comparators (for example 0 to 1 or 0 to 2) the calculation does not work. The same applies for the opposite 1 to 0 or even 2 to 0.

My workflow does work if I compare something like 1 to 2 or 2 to 1.

Am I doing something wrong or does the On Change not work for a comparison with 0?

---

<div class="post-metadata">

### Author: ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)
#### Post date: [October 31, 2016, 4:40pm UTC](https://forums.losant.com/t/solved-on-change-logic/282/2 "2016-10-31T16:40:49Z")

</div>

It looks like I can reproduce this as well. Our team is looking into it now. Thanks for the report!

---

<div class="post-metadata">

### Author: ![Bob\_Gelety](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Bob\_Gelety](https://forums.losant.com/u/Bob_Gelety)
#### Post date: [October 31, 2016, 4:58pm UTC](https://forums.losant.com/t/solved-on-change-logic/282/3 "2016-10-31T16:58:55Z")

</div>

Ok thanks. For now I am “mutating” any 0’s to 0.1 and the workflow works  
properly.

---

<div class="post-metadata">

### Author: ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)
#### Post date: [October 31, 2016, 6:06pm UTC](https://forums.losant.com/t/solved-on-change-logic/282/4 "2016-10-31T18:06:36Z")

</div>

We have identified and fixed the issue. You should now be able to use the node as expected. Thanks again for reporting it!

---

<div class="post-metadata">

### Author: ![Bob\_Gelety](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Bob\_Gelety](https://forums.losant.com/u/Bob_Gelety)
#### Post date: [October 31, 2016, 7:23pm UTC](https://forums.losant.com/t/solved-on-change-logic/282/5 "2016-10-31T19:23:34Z")

</div>

Thanks Brandon! Verified it is resolved. No more mutating…

---

<div class="post-metadata">

### Author: ![WoobaGooba](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/woobagooba/32/507_2.png) [@WoobaGooba](https://forums.losant.com/u/WoobaGooba)
#### Post date: [January 3, 2018, 2:08am UTC](https://forums.losant.com/t/solved-on-change-logic/282/6 "2018-01-03T02:08:38Z")

</div>

Bump… " am trying to use the On Change logic to make a determination if a value has toggled between 1 or 0. I am using two nodes one for an “Increase of at least” and another for “Decrease of at least”. I do not seem to be able to make this work using 1 as the value … "

I have an identical setup. Both On Change nodes are reporting “TypeError this.compareFunc is not a function”.

They are error free if Any Change is selected.

?

---

<div class="post-metadata">

### Author: ![Michael\_Kuehl](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/michael_kuehl/32/99_2.png) [@Michael\_Kuehl](https://forums.losant.com/u/Michael_Kuehl)
#### Post date: [January 3, 2018, 3:37am UTC](https://forums.losant.com/t/solved-on-change-logic/282/7 "2018-01-03T03:37:03Z")

</div>

Thanks for the bug report! We were able to reproduce your issue, and just rolled out a hot-fix, so the node should be working appropriately for you now.

Also, depending on what exactly you are attempting to do, I might suggest checking out the [Latch](https://docs.losant.com/workflows/logic/latch/) node as well - it might work well for your use case.

---

<div class="post-metadata">

### Author: ![WoobaGooba](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/woobagooba/32/507_2.png) [@WoobaGooba](https://forums.losant.com/u/WoobaGooba)
#### Post date: [January 3, 2018, 5:23am UTC](https://forums.losant.com/t/solved-on-change-logic/282/8 "2018-01-03T05:23:19Z")

</div>

Impressive response time!

Thanks and I will check out Latch.
