US Postal BarCode Function

96 views
Skip to first unread message

Blackbird

unread,
Aug 24, 2009, 6:00:18 PM8/24/09
to XMPie Interest Group
Hello - I have to put a postal bar code on my postcard project and I
have 3 fields in my data...one for ZIP, one for ZIP+4 and one for the
dpbc number. How do I combine those to create one bar code? I have
done it so it reads 333242635991 where each group of numbers is
represented ZIP5ZIP4DPBC3. I used the XMPPostNet font, and even
though it creates the bar code, it is not matching up to the sample I
have that is supposedly correct. Am I doing this right?

And as crazy as it sounds...I have forgotten how to make 4 digit zip
codes in my database change to 5 digits with a leading zero... Thanks
for your help!

modsyn

unread,
Aug 25, 2009, 12:01:30 AM8/25/09
to xmpie...@googlegroups.com
For the postnet barcode, you just use the ZIP5+ZIP4 (total of nine digits).

For adding a leading zero, are you talking about using SQL or using QLingo for this?

Bill

unread,
Aug 25, 2009, 2:37:36 AM8/25/09
to XMPie Interest Group
Hello.

Which version of uPlan or uDirect are you using?

"dpbc" sounds a little Chinese to me, as I do not usually use PostNet
codebars (BTW, hello to our Chinese group members and visitors ;-)

As far as I can see, the XMPPostNet QLingo function expects one single
parameter, which can be either a number or a character string, both
composed of exactly 5, 9 or 11 digits (providing different length will
result in an empty string in uDirect 4.6.1, or in a syntax warning +
empty string in uPlan 4.6.1).

Combining separate fields into a single value certainly depends on
their type. Should they already be string fields, you just need to
concatenate them with the QLingo "&":

|->[field1] & |->[field2]

Should they be number fields, you might first convert them to strings
before concatenating them:

AsString(|->[field1]) & AsString(|->[field2])

Should you want to force a particular format during the number-to-
string conversion, use the QLingo FormatNumber function:

FormatNumber(|->[field1], "000") & FormatNumber(AsString(|->[field2],
"#.00")

In your case, I guess it will be

FormatNumber(|->[zip], "00000") & FormatNumber(AsString(|->
[zip_plus_four], "0000") & FormatNumber(|->[dpbc], "00")

Total = 5 + 4 + 2 = 11 digits, great!

No need to take care of the PostNet checksum, which is calculted and
added to the barcode string by the function, along with the "*" header
and trailer.

On Aug 25, 12:00 am, Blackbird <blackbirdsbrokenwi...@gmail.com>
wrote:

Blackbird

unread,
Aug 25, 2009, 11:18:29 AM8/25/09
to XMPie Interest Group
I got it...thanks all! Something to note on these PostNet barcodes is
that you have to add a "|" initial and terminal bar to the front and
tail end of it.

Michael Bova

unread,
Aug 25, 2009, 1:26:33 PM8/25/09
to xmpie...@googlegroups.com
This is how I have the barcode set up in all of my plans
Database fields of ZIP and DP2
(My zip field includes the +4)

Create variable in uPlan ZIP4, FindAndReplace(|->[ZIP], '-', '')
Create variable in uPlan ZIP_DP2, @{ZIP4} & |->[DP2]

Create Barcode string ador XMPPOSTNET(ZIP_DP2 )

I use font IDAutomationPOSTNET set to 12 pt, you may have to stretch it to fit US postal standards.

Michael Bova
New Product Development
E-mail : Mb...@primadatainc.com
Phone: 920-347-1961 ext. 118
Fax: 920-347-1964
Reply all
Reply to author
Forward
0 new messages