Formatting

Giganews Newsgroups
Subject: Formatting
Posted by:  nick
Date: Thu, 25 May 2006

hi...can anyone help me with this zip-code formatting logic?

For US: The valid format is NNNNN-NNNN
- When US Zip Code length without '-' or ' ' is >5 and < 9 char then use
first 5 positions
- When Us Zip Code length is <5 chars then move space.
- When US Zip code is having alphabet, invalid and blank then move space
- When US zip code is having 9 char width then pass 5-4 format (99999-9999)
- When US Zip Code length without '-' or ' ' is >9 then use first 9 char.
- When Zip is empty or not valid, move '00000' to SAP

For CANADA: The valid format is CNC NCN
- When zip code length is >7 char, move first 7 char
- When zip code length is <7 char, move space
- When zip code is blank and invalid then move space.
- When Zip is empty or not valid, move 'A0A 0A0' to SAP

For London (county code GB):
- zip code must not exceed 9 characters (<=9 char).  If >9 char then, move
first 9 char.)
- When Zip is empty or not valid, move '000000000' to SAP

For Other countries:
- Pass as it is.

I built a formula but it doesnt support the condition of having an alphabet
and "-" in US format. I would appreciate it if i cld get any help. thank u

Replies