Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
cbushey1
Creator III
Creator III

In range syntax

I am looking to create an if statement that is based on a field having a range of possible values.

Example:

In SQL, you would write:

If fieldA in ["value1","value2"...] Then

     ....

How can I translate this into QV syntax?

Thanks,

5 Replies
fernando_tonial
Employee
Employee

Hi, use the funciotion Match()

If(Match(Field,'value1','value2',....), Value True, Value False)

Best Regards.

Tonial.

Don't Worry, be Qlik.
Anonymous
Not applicable

Have a look at the QlikView Match() or WildMatch() functions.

cbushey1
Creator III
Creator III
Author

Is there a way to do this using a range instead of typing all values?

Take the following:

001-015

Instead of typing each possible value out, could I enter a range into the Match function?

maxgro
MVP
MVP

you can't use a range in match function, you have to type all values

in wildmatch you can use wildcard (* ?)

or for range you can use a sql like syntax also in Qlik load

where field1 >= '009' and field1 <= '021';

Anonymous
Not applicable

Something like this should work:

Pick(Match(Round(FieldA,015),0,15,30,45,60,75,90,105),'A','B','C','D','E','F','G','H')

If you have trouble with it I'd convert your field to a number.