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: 
burak_ersoy
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:

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

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.

Sincerely,

Burak

15 Replies
Digvijay_Singh

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

sunny_talwar

I am using Feb 2018 Patch 1 here

Capture.PNG

and my mock up isn't showing any problems here

Capture.PNG

marcus_sommer

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

burak_ersoy
Contributor III
Contributor III
Author

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.

All,

Thank you for all your responses and recommendations.

MarcoWedel

other possible set expressions could be:

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

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

wdchristensen
Specialist
Specialist

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!