Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

clean data

Hi! I loaded a field containing zip codes. To make it neat I would like them to be formated as 'xxx xx', and most of them are, but not all. My first thought was to do it while loading by manipulating the string BUT I also have zip codes for three other countrys (country_id stored in another field). Is it the best way to do a temp table and then map that to the main table? Twice actually since I have to do it for all other countries as well. In SQL i would just set a condition, WHERE country_id=1, but I can't do that in loading? Only when loading resident, right?

1 Solution

Accepted Solutions
Not applicable

clean data

Concatenated zip_fix for countries and then joined that.

7 Replies
Not applicable

clean data

Omitted zip code from main, loaded zip, country_id and customer_id and then created MAPPING and ApplyMap. Switched the loading order so I create the mapping tables first and then I run the big one, with ApplyMap to get my clean swedish zip codes. Now I made another MAPPING for the other countries. I want them in the same field, naturally. So how do I merge the two MAPPINGS????

MVP
MVP

Re: clean data

Hi Thomas,

I would suggest to make mappings for each country. This would assure a separated treatment and no overlapping.

In the script you could try to use the mapping related to the country or make concatenated loads for each country with a Where Clause on country_code:

zip_code_SE:

MAPPING LOAD..

zip_code_GB:

MAPPING LOAD..

data:

LOAD ApplyMap('zip_code_' & country_code, zip_code) as zip_code...

- Ralf

Not applicable

Re: clean data

Hi Ralf! But won't that force me to execute main script twice (or as many times as I have countrys)? Won't I get as many tables as I have countrys? Right now I like to do something like this:
ApplyMap('new_zip_sweden',SITE_ID,ApplyMap('new_zip_not_sweden',SITE_ID,'')) as SITE_ZIPCODE
NO errors running the script but only not_sweden is correct. Not a friend of this editor!!!
MVP
MVP

clean data

No, you need not to run the script twice in my solution.

Btw. you have an error in your nested ApplyMap, this should work:

ApplyMap('new_zip_sweden', ApplyMap('new_zip_not_sweden', SITE_ID)) as SITE_ZIPCODE

Not applicable

clean data

Concatenated zip_fix for countries and then joined that.

MVP
MVP

clean data

What this mean? Can you give us more explanations..

Not applicable

clean data

Concatenated into one table:

new_zip:
LOAD...
WHERE country=1
concatenate LOAD...
WHERE country<>1

And then I Joined new_zip back to main LOAD

Community Browser