FORMAT
The format function allows the output format of a Geographic field to be changed into a number of different formats. This can be useful if your mailing house requires postcodes to be supplied in a specific format.
FORMAT ( <field_name or postal_code> [, STANDARD = 1 [, COUNTRY = UK ] ] )
-
field_name or postal_code: The geographic field to extract the area section from.
-
format: A number that indicates the formatting that should be applied
-
Country: Not required only UK postcodes are supported at this time.
| Len | Example 1 | Example 2 | Example 3 | Example 4 | Purpose | |
|---|---|---|---|---|---|---|
| 1 | =8 | AB10_1AA | AB_1_1AA | B__1_1AA | B_10_1AA | Left justify Area (trailing spaces to 2 char),Right justify Dist (leading spaces to 1 char),Insert 1 space,Right justify Sect. |
| 2 | =7 | AB101AA | AB1_1AA | B1__1AA | B10_1AA | Left justify Area,Left justify Dist,Pad with spaces to fill,Right justify Sect. |
| 3 | <=7 | AB101AA | AB1_1AA | B1_1AA_ | B10_1AA | Left justify Area,Left justify Dist,Insert 1 space if room,Left justify Sect. |
| 4 | <=8 | AB10_1AA | AB1_1AA_ | B1_1AA__ | B10_1AA_ | Left justify Area,Left justify Dist,Insert 1 space,Left justify Sect. |
| 5 | =7 | AB101AA | AB1_1AA | B_1_1AA | B_101AA | Left justify Area (trailing spaces to 2 char),Left justify Dist,Insert 1 space if room,Left justify Sect. |
| 6 | <=7 | AB101AA | AB1_1AA | B1_1AA_ | B10_1AA | Left justify Area,Left justify Dist,Insert 1 space if room,Left justify Sect. |
Example: Create 6 fields that the HOUSEHOLD level that changes the format of the postcode field into the specified format.
FORMAT( HOUSEHOLD.POSTCODE , 1 )
FORMAT( HOUSEHOLD.POSTCODE , 2 )
FORMAT( HOUSEHOLD.POSTCODE , 3 )
FORMAT( HOUSEHOLD.POSTCODE , 4 )
FORMAT( HOUSEHOLD.POSTCODE , 5 )
FORMAT( HOUSEHOLD.POSTCODE , 6 )