If we run the following piece of script into Qlik Sense:
set nullinteger='-';
load *,
if(not match(B,5),'No Match', 'Match') as Check_Not_Match,
if ( match(B,5),'Match','No Match')as Check_Match;
load*
inline [
A, B
3, 5
6, -
20, 7];
We notice that Check_Not_Match seems to be showing the wrong result when B is NULL, as shown below.
We expected the table to look like as below.
Why is this happening? How can we get the expected result?
The behaviour describing is correct. The match function returns NULL when the argument is NULL and the conditional applied to a NULL is always FALSE ( the NOT is part of the conditional in this case).
Resolution:
To solve the issue, we have to modify the script so that we also check for NULL values, as shown below.
set nullinteger='-';
load *,
if(not match(B,5),or len(B)=0,'No Match', 'Match') as Check_Not_Match,
if( match(B,5),'Match','No Match')as Check_Match;
load*
inline [
A, B
3, 5
6, -
20, 7];