FOURSTATE
Returns a string of digits, each digit from 0 to 3, representing the bars in the 4-state barcode, including any start/stop characters and characters for error detection or correction. Use the output from the FOURSTATE function as values in the <ADDPART> tag when creating a 4-state barcode.
Use the FOURSTATE function if you are creating a 4-state barcode for use in the U.K, Australia, and Singapore. If you are creating a barcode for use in the U.S., use the IMB (Intelligent Mail Barcode) function.
Syntax
FOURSTATE (string, country, [option])
Arguments
Argument | Description | Default | |
---|---|---|---|
string | An input string to be converted to the string of digits required to draw the 4-state bar code. The content of this string varies by country. For the United Kingdom, string is the postal code, optionally including the start and stop symbols and the check character. The characters “(“, “)”, and space are skipped. Numbers and upper case letters are processed. Any other character is considered invalid. For the United States, string consists of five fields:
If the value of a field contains fewer digits than the number of digits assigned to that field, the field must be padded with leading zeros. For example, if your special services number is 12, the number in the string should be 012. For information on 4-state barcode use in the United States, see the USPS® website. |
None | |
string (cont) | For Australia, the 4-State Postal Code is comprised of three fields | None | |
FCC | Format Control Code - 2 digits | ||
DPID | Delivery Point ID - 8 digits | ||
Customer Information | variable length, mixed case | ||
From these fields, there are three possible lengths of bars: 37, 52, or 67. | |||
The following are possible values of FCC: | |||
11 | Standard Customer Barcode | ||
45 | Reply Paid Barcode | ||
95 | Redirection Barcode | ||
59 | Customer Barcode 2 | ||
62 | Customer Barcode 3 | ||
44 | Reserved | ||
The Australian 4-State Postal Code always start and end with the Ascender Tracker (AT) sequence. An algorithm is applied to the three input fields to encode a barcode with Reed Solomon error correction code. | |||
For Singapore, the 4-State Postal Code is exactly the same as the UK Royal Mail specification in dimensions and encoding method. The Singapore 4-State PostalCode is 6 digit numeric only and always expects a check digit. | |||
country | A string containing the Internet abbreviation for the country for which the bar code is to be generated. Currently, the only supported values are AU, SG, UK, and US. | None | |
[option] | For SG, a digit indicating which option is to be used to generate the code. | ||
0 | The function generates the check character. | ||
1 | The function does not generate the check character (it is assumed to be present in the input string). | ||
For AU, a digit indicating which type of Australia 4 State barcode to generate. The types are the same as the <AUSPOST> tag. See <AUSPOST> for details. |
Results
Result | Description | |
---|---|---|
Return | A string of digits from 0 to 3 that represent the bars in the 4-State bar code. The numbers indicate the following: | |
0 | Full bar | |
1 | Ascender | |
2 | Descender | |
3 | Tracker | |
![]() |
||
%%RC | One of the following: | |
-1 | Invalid country | |
-2 | Invalid option for country | |
-3 | Invalid string length | |
-4 | Invalid barcode identifier. The barcode identifier is the 2nd digit in string. It must be between 0 and 4 | |
0 | No error | |
1 | Invalid data found in string | |
%%RM | A null string (''). | |
%%RV | The total number of digits (bars) generated. For U.S., this value will be 65 if the call was successful. |
Examples
Function Call | Return | %%RC |
FOURSTATE('SN3 4RD 1A', 'UK') |
10303023123102301031230123210212112210 |
0 |
FOURSTATE('SN3 4RD 1A', 'UK', 0)
|
1030302312310230103123012321021210 |
0 |
FOURSTATE('SN3 4RD 1A K', 'UK', 1) |
10303023123102301031230123210212112210 |
0 |
FOURSTATE('012345670949876543 2101234567891','US',) |
1123002032123112113023221112232332 1012122230002233312011120321121 |
0 |