Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Set Analysis to filter out 3 digit zipcodes

Hello All,

We wrote a set analysis script in order to filter out the patients with 3 digit zip codes in our dataset. Here is the script:


It was working just fine in version 3.2; however, it stopped working without an error after our system update to Feb 2018.

Do you have any suggestions to fix this script for version Feb 2018?

Thanks in advance.



15 Replies

I checked this expression in Feb 2018 with a small sample, it works for me. See attached.


I am using Feb 2018 Patch 1 here


and my mock up isn't showing any problems here


MVP & Luminary
MVP & Luminary

If there are not too many different lengths of your zip-code you could try to reverse your approach with something like:

Count({$<PAT_ZIP =  {'("????"|"?????")'}>}  PAT_ID)

which would only count zip-codes with 4 or 5 chars.

Edit: If I look on the examples from Sunny and Digvijay I wonder if your 3 digit zip-code really contained 3 chars. Therefore I would be useful to check the length of them and if they are different like expected to investigate the real content of these fieldvalues.

- Marcus

Contributor III
Contributor III

Sunny Talwar,

Thank you for your response. I imported the example app in my environment and it looks like all the expressions are working just fine. I am not sure why the script is not working in my app; however, I am not able to share the app in here unfortunately. I will take the suggestions from everyone and try to solve this by myself. Thank you for sharing the example app again.


Thank you for all your responses and recommendations.


other possible set expressions could be:

{$<PAT_ZIP={"(not like ???)"}>}

{$<PAT_ZIP={"=not PAT_ZIP like '???'"}>}


I am assuming you are trying to exclude US provinces and territories outside the United States States (Virgin Islands / Ruerto Rico). These locations start with 2 leading zeros and could be the source of your issue. I suspect the cause of this issue is the dropping of leading zeros in your zip code. Likely  version 3.2 data type was acting like an integer and dropping the leading zeros and now it is acting like a string. If this theory is correct then adding two leading zeros back in should "Fix" your set analysis.

Count({$<PAT_ZIP-={"00???"}>} PAT_ID)

However you might want to consider why you are excluding these records in the first place. I know an answer was already marked corrected but please mark this answer as helpful if my answer was also "correct". Good luck!

View solution in original post