Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
i not unterstand why the folling if statement produce a 'no' ,because a special character '-' more than space character like ' '?
if( '-' > ' ','yes','no')
result : no
Have anyone an idea what operation QlikView do in the bakground ?
hi,
Use this:
=if( ord('-') > ord(' '),'yes','no')
HTH
Sushil
Yes this works, but is this behaviour when i not use ord function normal in QlikView that '-' ist not more than ' ' ?
- and ' ' is treated as character and you can not do greater than or less than of some character values... for this to happen you need to convert the chartacter value to corresponding numerical value..
that is why i have used ord() function.
Regards,
Sushil
Dear,
please close the issues by marking the correct answer when the solution has been given as desired.
Regards
Gaurav
Hi pkrolicki,
I assume there is another value in the field...
I tried the following and the result is always "YES".
tmp:
LOAD * INLINE [test,test2
-,
'-',''];
TEST:
LOAD
//IF(test > test2,'YES','NO') AS bla // --> YES
IF(test > '','YES','NO') AS bla // --> YES
//IF(test > null(),'YES','NO') AS bla // --> NO
RESIDENT tmp;
Perhaps there is a difference between ' ' and '' ... the blank between the quotes. I don't know if you have a blank in your example. You could check this.
Hope it helps!
- PS -
yes a blank is between the ' ' . I think the comparison beetween '-' and ' ' is for QV unlogical.
Or a blank is > than '-' for QV ...is it necessary to have fields with a blank? In some cases this can be very confusing...? I think simple comparing(greater as..)of chars is unlogical at all..ok with abc you could do the ranking based on the alphabet etc. . And that a char is greater than no char could be logical too. But "minus" vs. "blank" ....
Perhaps the function chr() can help you in some situations...
Could be QV is trying to resolve the '-' as a numerical negative rather than just hyphen. Consider this equation ...
=if('-0.6'>'-0.5',1,2) ... which returns 2.
Textually '-0.6' comes after '-0.5' but QV resolves the values to numbers and correctly calculates the numerical comparison where -0.6 is less than -0.5. If '-' is resolved as a number and the other value is text, they cannot be compared and cannot be true, therefore false.
Think only Qliktech could confirm.
flipside
Yes it could be so but why the result for the following :
1:
Load * Inline
[a
'-'
' , '
' ' '
' " '
'{']
;
2:
Load
if( a > ' ','yes','no'),
* resident 1;
is : no
no
yes
yes
yes
? It seems to be a logic behind it ...