Page 1 of 1

If Variable XYZ Equals 0 fails on Check with Var-Value 0

Posted: Mon Nov 24, 2008 11:13 am
by voiid
The 'If Variable XYZ Equals 0(Zero) statement fails while debugging and runtime if it gets evaluated against the Variable with a Value of 0(Zero).
To me this behavior is wrong, as my variable value is 0(zero) and I test if this variable is equal zero to jump into the condition.

Manual:
Choose a comparison type from the drop down menu. If both variables contain integer values, a numeric comparison will be performed. If at least one variable contains a non-integer value, a string comparison will be performed.

Thanks for your help guys.

snippet?

Posted: Tue Nov 25, 2008 2:52 am
by ulrichard
Hi voiid,

these comparisons always worked for me, so I created a small example to try what you described:

Set Variable intval to 0
if Variable intval Equals 0
MessageBox: zero, zero
end

Set Variable intvalA to 0
Set Variable intvalB to 0
if Variable intvalA Equals $intvalB$
MessageBox: zero, zero
end


As expected, both messageboxes got displayed.

Could you post a snippet with a bit more detail?

Maybe you were missing the $DOLLAR$ signs in the expression part of the if statement?

Rgds
Richard

Hello ulrichard

Posted: Tue Nov 25, 2008 3:25 am
by voiid
Thanks for your help.

Well what I simply do is the following.

Set Persistent Variable ARCONVERSION to 0 at the top of the script

and then later in the setup routine ...

if Variable ARCONVERSION Equals 0
....
end

And the variable really contains 0(zero).

translation

Posted: Tue Nov 25, 2008 10:32 am
by ulrichard
from reading your other post, this might well be also translation related.

Rgds
Richard

Posted: Thu Jan 14, 2010 7:58 am
by thohoff
I think I got the same problem. Comparision with exit code 0 (zero) did not work. Now I solved it with the following workaround

Code: Select all

set Varialbe TEST to $ARCONVERSION$_string
if Variable TEST Equals 0_string   (i.e. Zero + _string)
    ...
end
Now this enters the IF block. Seems to be a type conversion problem for 0 (Zero) values.