Axaptapedia is now maintained by AgileCadence For more information please click here.

Difference between revisions of "Zip codes"

From Axaptapedia
Jump to: navigation, search
(New page: Sometimes zip codes are used in main tables, but the corresponding zip code does not exist. This could happen after a data conversion! The following job creates the missing zip codes. <x...)
 
(Category)
 
Line 39: Line 39:
 
}
 
}
 
</xpp>
 
</xpp>
 +
 +
[[Category:Development tools]]

Latest revision as of 05:01, 5 September 2011

Sometimes zip codes are used in main tables, but the corresponding zip code does not exist. This could happen after a data conversion!

The following job creates the missing zip codes.

<xpp> static void ZipCodeCreate(Args _args) {

   CustTable CustTable;
   VendTable VendTable;
   Counter zipCreate(AddressMap record)
   {
       AddressZipCode z;
       AddressZipCode ze;
       Counter c;
       while select record
           where record.ZipCode && record.CountryRegionId
           notexists join ze
           where ze.CountryRegionId == record.CountryRegionId &&
                 ze.County          == record.County &&
                 ze.State           == record.State  &&
                 ze.ZipCode         == record.ZipCode
       {
           z.clear();
           z.CountryRegionId = record.CountryRegionId;
           z.County          = record.County;
           z.State           = record.State;
           z.ZipCode         = record.ZipCode;
           z.City            = record.City;
           z.insert();
           c++;
       }
       info(strFmt("%1 created from %2", c, tableId2pName(record.TableId)));
       return c;
   }
   ;
   zipCreate(CustTable);
   zipCreate(VendTable);

} </xpp>