1 Reply Latest reply on Feb 5, 2008 10:55 AM by Dan Bracuk

    ZipCode validation based on locale

    Supercyberal
      Hello All.

      I'm currently developing an application and i kind of ran into some problems that i'm trying to find a possible solution. This app will be used for many users spread out into Europe, Asia and Americas and one requirement is to validate a given zipcode based on the user's locale.

      I've been trying to find examples on any possible web search engine that you could possible think of and no results so far.

      Please, if any examples/questions fell free to write me or reply to this topic, your help is greatly appreciated.

      Thanks

      Alvaro Costa
      Software Engineer
      acosta@jaggedpeak.com
        • 1. Re: ZipCode validation based on locale
          Dan Bracuk Level 5
          Here is a macro (sql function) we use for Canadian Postal Codes. Bear in mind that the data we receive does not have the normal space between the 3rd and 4th characters. The percentage sign represents the argument.

          returns Y or N to indicate whether postal code is valid CASE WHEN
          SUBSTR(%1,1,1)IN('A','B','C','E','G','H','J','K','L','M','N','P','R','S','T','V','X','Y')A ND SUBSTR(%1,2,1)IN('0','1','2','3','4','5','6','7','
          8','9')AND SUBSTR(%1,3,1)IN('A','B','C','E','G','H','J','K','L','M','N','P','R','S','T','V','W','X', 'Y','Z')AND SUBSTR(%1,4,1)IN('0','1','2','3
          ','4','5','6','7','8','9')AND SUBSTR(%1,5,1)IN('A','B','C','E','G','H','J','K','L','M','N','P','R','S','T','V','W','X', 'Y','Z')AND SUBSTR(%1,6,
          1)IN('0','1','2','3','4','5','6','7','8','9')THEN 'Y' ELSE 'N' END