7 Replies Latest reply: May 16, 2011 5:18 AM by Thomas Ljungström RSS

    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?

        • 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????

            • Re: clean data
              Ralf Becher

              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:



              MAPPING LOAD..



              MAPPING LOAD..



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


              - Ralf

                • 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!!!
              • clean data

                Concatenated zip_fix for countries and then joined that.