Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQLs WHERE IN functionality but for an expression

In an expression I am carrying out something like the following:

IF(AGENT='James' OR AGENT='Adrian' OR AGENT='Neil', 1, 0)

Is there a way I can check AGENT against all of those values at once? I tried something like

IF(AGENT IN ('James','Adrian','Neil'), 1, 0)

But it didn't work. Ideally I'd like to store the array of names in a variable, so I could have something like

IF(AGENT = $vAgentsAllowed, 1, 0)

If $vAgentsAllowed was, say something like ('James','Adrian','Neil')

Can this be done? Thanks, George.

1 Solution

Accepted Solutions
PrashantSangle

Hi,

You can use Wildmatch()

Try This,

If(Wildmatch(AGENT,'James','Adrian','Neil'),1,0)

Regards,

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 🙂

View solution in original post

5 Replies
its_anandrjs

Use like  IF(Match(AGENT,'James','Adrian','Neil') 1, 0)

Hope this helps

Thanks & Regards

PrashantSangle

Hi,

You can use Wildmatch()

Try This,

If(Wildmatch(AGENT,'James','Adrian','Neil'),1,0)

Regards,

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 🙂
Not applicable
Author

Thanks, that works perfectly. But how would I put the array of names into a variable and use that variable in the Match() function? Also, How does the Wildmatch() function differ from the Match() function?

PrashantSangle

Hi,

There is only one difference between Match() and Wildmatch()

Wildmatch():

You can Use Special Character like * and ?

as well Wildmatch () contain case Insensative data

You can not do same with match()

Regards,

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 🙂
Not applicable
Author

That makes sense, so could you let me know how to use a variable with Wildmatch()?