Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like to understand why:
100> 'NA' is False (0)
and
100< 'NA' is True (-1)
It can be any number vs any string, instead of 100 and 'NA'.
From qlik help: 'A numeric comparison is made if both operands can be interpreted numerically. '
How is a string interpreted numerically in this case?
The problem appears when I am getting a string where it should be a number, and if the comparison gives True or False it is not correct.
Thank you.
I have received an answer from Qlik Support. It is this:
"When comparing a number with the string, the outcome would be similar to how the values would sort if you show them as descending or ascending order in the table object. The natural order is to sort numbers first, so a numeric string is smaller in that sense."
I don't know why Qlik behaves in this way and if it should be regarded as a bug or not. Personally I would tend to address this topic at least one step before by checking the fieldvalues if they are numeric or not and cleaning/replacing the values. Nevertheless you could adjust your check with something like this:
('NA'<100)*isnum('NA')
- Marcus
Thank you Marcus for your time, but I will not Accept as Solution yet, as this is a workaround.
I have submitted a case with qlik support and I will get back if I get an answer.
I have received an answer from Qlik Support. It is this:
"When comparing a number with the string, the outcome would be similar to how the values would sort if you show them as descending or ascending order in the table object. The natural order is to sort numbers first, so a numeric string is smaller in that sense."