About EasyMorph Tutorials & Examples Web-help

Empty value in rule failing?


#1

I have a rule that checks if a field value is in some boundaries. If it is in the boundaries, it has to return empty(), if the value is empty, it must also return empty().

I noticed that when I add the rule like below, when DOSSIER_NUMMER is an empty value, it does not return the empty value as set in the rule. When I separate that in 2 conditions, first checking if it is empty and then checking the boundary conditions, it is working. Why does it fail in the first option ?
I should expect that the rule also returns to true?

See the example file in attachement.

([DOSSIER_NUMMER] >= 4000000000 and [DOSSIER_NUMMER] <= 4000999999)
or ([DOSSIER_NUMMER] >= 8000000000 and [DOSSIER_NUMMER] <= 8000999999)
or ([DOSSIER_NUMMER] >= 780000000 and [DOSSIER_NUMMER] <= 7800009999)
or isempty([DOSSIER_NUMMER])

example.morph (2.7 KB)


#2

Hi Nikolaas,

That’s because comparison between a number and an empty value results in the #Incomparable values for '>=' error. You can check that by feeding you expression to a temporary “Calculate new columns” action.

It seems that your second “Rule” action is the correct approach here.


#3

Hi Andrew,

Thanks but I am afraid that I am not following your explanation. I see indeed that it gives an error when I put it in a new columns action but it is weird. How is the expression evaluated?

I thought that it would evaluate it sequentially e.g.

([DOSSIER_NUMMER] >= 4000000000 and [DOSSIER_NUMMER] <= 4000999999) ==>FALSE
or ([DOSSIER_NUMMER] >= 8000000000 and [DOSSIER_NUMMER] <= 8000999999) ==>FALSE
or ([DOSSIER_NUMMER] >= 780000000 and [DOSSIER_NUMMER] <= 7800009999) ==>FALSE
or isempty([DOSSIER_NUMMER]) ==>TRUE

so the result = TRUE and thus the rule is applied.

However it does not seem to be the case. For example when I only put the following expression in a rule

([DOSSIER_NUMMER] >= 4000000000 and [DOSSIER_NUMMER] <= 4000999999)

it will not raise an error on the empty value but when you put it in the add new columns action, it will raise an error on the empty value.That’s the reason why I was becoming a fan of the rule action because I do not have to write the isnumber() check and isempty() check anymore to correctly deal with empty values.

It is a bit confusing now for me as how to deal with empty values correctly in various expressions. Could you maybe explain a bit more ? Maybe posting an article about it because it is a very import topic I guess.


#4

Nikolaas, in EasyMorph the whole expression is parsed and evaluated for correctness at once. So your
expressions in not calculated at all. It seems that it results in an error on the stage of evaluation.

Condition in Rule action will only work\match when expression returns TRUE, but your expression returns an error.

This expression will result in an error too. But since you have a second condition in your example (if isempty([DOSSIER_NUMMER]) then empty()), Rule action will result in empty(). When the second condition is removed from the second Rule action in your example, it will give you exactly the same result as the first Rule action:


#5

Ok thanks. Empty value is a dangerous type I beleive. I think it is worhwhile devoting an article about it ?