Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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
Anonymous
Not applicable

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
Anonymous
Not applicable

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

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????

Anonymous
Not applicable

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
Partner - Champion III
Partner - Champion III

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

P.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

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.