AnsweredAssumed Answered

NULL field evaluates as true to equal zero

Question asked by DanielShanahan on Feb 5, 2019

I've just noticed this and can't remember if I've run into it before or if it is expected behavior. I'm not a fan of it.

 

I have a null field. It is intentionally null. It is a field for users to update data. Users can add any number, including 0. Also, the field is a repetition. The first repetition holds the original quantity and the second is where the user can make an update. For example:

 

TABLE::myQuantity and TABLE::myQuantity[2]

 

TABLE::myQuantity has a value of 4. Now I present the user with an option to change that value and they do that in the TABLE::myQuantity[2], which is null.

 

When I evaluate this in a script IF statement, TABLE::myQuantity[2] = 0 returns true when the field is null. So, I'll have to add additional conditions to the IF statement:

 

If [ not IsEmpty ( TABLE::myQuantity[2] ) and TABLE::myQuantity[2] = 0 ]

Do Something

Else IF

Do Something else

Else

Do Something

End IF

 

Is this expected behavior?

 

Screen Shot 2019-02-05 at 12.27.28 PM.png

Outcomes