Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Where statement in Scripting

Hello Everyone,

I'm trying to fetch the required records using where condition in the script.

Please lemme know whether the syntax i'm using is accurate or not.

Where Name='A' and (Zone='1' or Zone='2' or Zone='3' or Zone='9') and Name='B' and (Zone='12' or Zone='24' or Zone='37');


Please help.

1 Solution

Accepted Solutions
bill_markham

That looks as if it will never return anything as Name will never equal 'A' and equal 'B'.

A complete guess here as to what your requirements are but this would probably return some rows :

Where

( Name='A' and (Zone='1' or Zone='2' or Zone='3' or Zone='9') )

  or

( Name='B' and (Zone='12' or Zone='24' or Zone='37') );

View solution in original post

7 Replies
bill_markham

That looks as if it will never return anything as Name will never equal 'A' and equal 'B'.

A complete guess here as to what your requirements are but this would probably return some rows :

Where

( Name='A' and (Zone='1' or Zone='2' or Zone='3' or Zone='9') )

  or

( Name='B' and (Zone='12' or Zone='24' or Zone='37') );

View solution in original post

markgraham123
Specialist
Specialist
Author

Hi Bill,

There were many Zone values under Names A and B

I wanna return values only Zone = 1,2,3,9 from A

and

Zone = 12, 24, 37 from B.

Its working...:)

Can i use the same logic for multiple parameters like Name C, D. ..etc..?

markgraham123
Specialist
Specialist
Author

Hi BIll,

Can i use Zone='1*' to fetch all the zonez starting with 1????

bill_markham

It could look neater with the Match() function :

Where

( Name='A' and Match ( 'Zone'  ,'1' , '2' , 3' , '9') )

  or

( Name='B' and Match ( 'Zone'  , '2' , '24' , '37') ) ;



... and yup, you should be add same logic for your other Name values.



[Editted as I did a typo]

Peter_Cammaert

Still another typo: no quotes around the field name... I won't tell anyone however

P.

Peter_Cammaert

Use Wildmatch(Zone, '1*') instead of Match(Zone, '1') if you want to play with wildcards in Bill's example above. See QV Desktop help for more info.

markgraham123
Specialist
Specialist
Author

Hi Peter,

Thanq Verymuch.