Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Not applicable

string comparison and wildcard question, Like and Not Like operator

I'm very new to Qlikview,

I have an if statement in my load script from  sql table , but am having trouble getting the wildcard string comparisons to work.

This is what I have, but it is not matching the '%' to 0 or more characters before or after the string 'events'.

   if (( Medium Like '%events%'  ), 'PREvents', 'Other') as channel

Also: Is there something that is equivalent  to ' NOT LIKE'  I like to be able to have a condition based on something that does not contain a string.

if (( Medium NOT Like '%viral%'  ), 'Direct', 'Other') as channel

Thanks.

-Ming

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: string comparison and wildcard question, Like and Not Like operator

I think you are looking for the wildcard character * (any number of arbitrary characters):

      if ( Medium Like '*events*', 'PREvents', 'Other') as channel


and not like should be like


     if ( not Medium Like '*viral*', 'Direct', 'Other') as channel


View solution in original post

3 Replies
Highlighted
mov
Esteemed Contributor III

Re: string comparison and wildcard question, Like and Not Like operator

The answer is in the title of your question ...  almost

See function wildmatch()

Regards,

Michael

Highlighted
MVP
MVP

Re: string comparison and wildcard question, Like and Not Like operator

I think you are looking for the wildcard character * (any number of arbitrary characters):

      if ( Medium Like '*events*', 'PREvents', 'Other') as channel


and not like should be like


     if ( not Medium Like '*viral*', 'Direct', 'Other') as channel


View solution in original post

Highlighted
Not applicable

Re: string comparison and wildcard question, Like and Not Like operator

That worked perfectly.

Thanks for the speedy reply.

-Ming