About EasyMorph Tutorials & Examples Web-help

Comparison with empty value fails


#1

Dear,

When I apply a rule such as if([COL_A]>10, “To check”, empty()) I get the following error for the records for which COL_A = empty(): #Incomparable values for ‘>’

I would expect that normally these empty values should be ignored in such a comparison ?

Could you help me out here ?

Thanks in advance !

Nikolaas


#2

Hi Nikolaas,

EasyMorph doesn’t ignore errors because the IF function has two explicit outcomes – one when condition is TRUE, the other one when condition is FALSE. Assuming an error always means FALSE may lead to calculations that look correct but actually are erroneous – a very dangerous, and therefore undesirable case.

You can wrap the condition into another condition that checks data type first, or better use the “Rule” transformation as it’s better suited for nested conditions with multiple outcomes.

PS. For the same reason all transformations that use expression-based conditions (Filter by condition, Halt on condition, Trim by condition, and Derive table) will fail if the condition can’t be evaluated to either TRUE or FALSE.


#3

Ok thanks. I solved it using a nested if() as you suggested by first checking if its a numeric data type and then do the comparison if it’s true.