Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
cata_pli
Partner - Contributor III
Partner - Contributor III

Relational operators - Number vs String

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.

Labels (3)
1 Solution

Accepted Solutions
cata_pli
Partner - Contributor III
Partner - Contributor III
Author

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."

View solution in original post

3 Replies
marcus_sommer

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

cata_pli
Partner - Contributor III
Partner - Contributor III
Author

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.

cata_pli
Partner - Contributor III
Partner - Contributor III
Author

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."