Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Concatenated zip_fix for countries and then joined that.
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????
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
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
Concatenated zip_fix for countries and then joined that.
What this mean? Can you give us more explanations..
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