Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Breezy
Creator II
Creator II

"in" statement in script?

Hi, 

Here is part of my syntax that I intend to load. I would like to include "NUMBER" for only numbers that equate to '01', '02', '03', etc. For all of my data it goes up to number 99 and I don't want that. My "IN" statement is incorrect. It is pinked out. What is the correct syntax? Or do I have to make a new statement for each and every number? Thank you 

 

COUNTRY,

STATE,

CITY

WHERE YEAR='2019’or YEAR='2020' or YEAR= '2021'

AND VIOLATION='Y'

AND AREACODE=‘234' AND NUMBER IN ('01','02','03','04','05','06','07','08','09','10’,’PP');

Labels (1)
5 Replies
Breezy
Creator II
Creator II
Author

Hi, I am looking up 'match' now and the examples are confusing. I am trying this. What did I do wrong? It's still in pink. 

 

COUNTRY,

STATE,

CITY

WHERE YEAR='2019’or YEAR='2020' or YEAR= '2021'

AND VIOLATION='Y'

AND AREACODE=‘234' AND WHERE match (NUMBER, '01','02','03','04','05','06','07','08','09','10','PP');

edwin
Master II
Master II

two things i noticed:

some of your single quotes are back quotes and

you have an extra WHERE clause.  remove the 2nd where:

edwin_0-1658877997128.png

i normally use match(...) > 0, but i suppose not having the >0 will also work, but test it out

edwin
Master II
Master II

look at the examples in the doc, you should follow it:

edwin_1-1658878102160.png

 

sidhiq91
Specialist II
Specialist II

@Breezy  Use the script something as shown below:

Load

COUNTRY,

STATE,

CITY

WHERE Match(YEAR,'2019','2020','2021')

 

AND VIOLATION='Y'

AND AREACODE=‘234' AND Match(Number,'01','02','03','04','05','06','07','08','09','10','PP');

I guess this is what @edwin is trying to explain it you. Please let me know if this worked.