It is currently April 20th, 2024, 3:28 pm

[Solved] Calc not working. (IfEqualValue=0 not working)

Get help with creating, editing & fixing problems with skins
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Calc not working.

Post by JpsCrazy »

jsmorley wrote:It's not that it is broken, it is just that you have to understand that an IF action is fired when it becomes true. It does NOT fire again, until it becomes false, and then true again. It is that way on purpose so it doesn't just get into a runaway loop of firing the action. So since the value of a calc or other measure starts as "0", an IfBelowAction statement is going to be true if the IfBelowValue is positive. It will stay true until the value is either above or equal to the IfBelowValue and then goes back to below.

It's how it works. There is always a way around any limitations this causes by clever use of corresponding IfEqual and IfAbove statements, but it's not "broken".
That's really frustrating... But I got it to work.
Added a IfAbove to hide what IfEqual showed.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Calc not working.

Post by jsmorley »

JpsCrazy wrote: That's really frustrating... But I got it to work.
Added a IfAbove to hide what IfEqual showed.
Exactly. I find that in many cases it works best if you have both IfAboveValue/IfAboveAction and IfBelowValue/IfBelowAction statements on the same measure, to control the "true / false" conditions the way you want.

In some ways how this works in not terribly intuitive at first, but makes sense if you think about what would happen if you had an IfAboveAction that played a loud beep or something on a measure that checked your email and was set to "1" so it beeped when you got a new mail. It would not only beep when it went from 0 to 1, and from 1 to 2, but on EVERY update while it was still 1.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Calc not working.

Post by JpsCrazy »

jsmorley wrote: Exactly. I find that in many cases it works best if you have both IfAboveValue/IfAboveAction and IfBelowValue/IfBelowAction statements on the same measure, to control the "true / false" conditions the way you want.
Yepp. That's what I did.
I ended up changing it from
IfEqualValue=0 to
IfBelowValue=10
IfAboveValue=9
With the corresponding actions of course.