Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gussfish
Creator II
Creator II

LIKE operator confuses hyphen and single quote?

Hi all, I've been chasing an unexpected behaviour this afternoon and have narrow it down to this: the LIKE operator seems to confuse hyphens and single quotes.  Specifically, both of these expressions evaluate to logical true (-1):

  • chr(39) like '-'
  • '-' like chr(39)

Has anyone else come across this?  Looks like a product defect to me.

I'm using QlikView 12.0.  Does it happen in any more recent version?

Update: I've tried this in my company's QlikSense environment (12.674.4 / 4.0.X) , and it works correctly.  So, it looks like it's a problem already resolved in that engine version. 

1 Solution

Accepted Solutions
tresesco
MVP
MVP

I can confirm that I too am experiencing the same unwanted behavior. Also when I try few more things to understand the qlik engine behavior, I found that this happens so when we are comparing using a wild card function. I.e. - if you use direct comparison with '=', 

chr(39)='-'        // returns 0 - OK

Match(chr(39), '-')      //returns 0 - OK 

however, if we use wildcard functions - LIKE/wildmathc() - it behaves unexpectedly 

chr(39) Like '-'        //returns -1 ; Wrong

Wildmathc(chr(39), '-')   //returns -1; Wrong

 

That means, possibly qlik engine is doing something additional for such cases of comparison. May be @hic , would have some ideas .

View solution in original post

3 Replies
PrashantSangle

did not get your query. what are you trying to do? 

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tresesco
MVP
MVP

I can confirm that I too am experiencing the same unwanted behavior. Also when I try few more things to understand the qlik engine behavior, I found that this happens so when we are comparing using a wild card function. I.e. - if you use direct comparison with '=', 

chr(39)='-'        // returns 0 - OK

Match(chr(39), '-')      //returns 0 - OK 

however, if we use wildcard functions - LIKE/wildmathc() - it behaves unexpectedly 

chr(39) Like '-'        //returns -1 ; Wrong

Wildmathc(chr(39), '-')   //returns -1; Wrong

 

That means, possibly qlik engine is doing something additional for such cases of comparison. May be @hic , would have some ideas .

gussfish
Creator II
Creator II
Author

I'm asking to see if others agree that this behaviour of the LIKE operator is defective, before I submit it to Qlik for them to fix in a future release.

For the record, I'm not asking for help with my code - I've already implemented a workaround.