Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

cbushey1
Contributor II

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,

Tags (1)
5 Replies
fernando_tonial
Valued Contributor

Re: In range syntax

Hi, use the funciotion Match()

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

Best Regards.

Tonial.

Re: In range syntax

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

cbushey1
Contributor II

Re: In range syntax

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?

MVP
MVP

Re: In range syntax

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';

qlinikalanalyst
New Contributor II

Re: In range syntax

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.

Community Browser