Barcoding in Alpha Five is easy - Part I -Setting up Alpha Five

Barcodes are in use everywhere, and for good reason.  Quite simply, they save time and money.  If you develop Alpha Five professionally, setting clients up with barcoding can be a lucrative service.  If you work for a company, setting them up with barcodes can nail that raise you've been looking for, and if you own your own business, you can save yourself quite a bit of stress (and money) as your business grows!

This is the first of what will be three articles directed toward integrating barcodes in Alpha Five.  This article will discuss how to set up your application, and the use of barcode fonts.  The second article, due in August, will give detailed information on the equipment that is available, and the third article will demonstrate the use of a portable data collector and how to dump the data into Alpha Five.

While all this all may sound intimidating, it's really very easy.  The first step is to determine what barcode format best suits your needs.  While there are more than a dozen varieties of barcode in use, there are two that stand out and are the most common.  They are UPC-A and CODE39. 

UPC-A is the most common and is used in the retail world.  Pick up any product for sale, turn it over, and you'll see a twelve digit barcode on it.

UPC-A is a fixed number registered with The Uniform Code Council.  Each product registered has it's own unique number assigned to it.  In this case, the product is a box of 50 envelopes made by Mead.  As such, you should not make up your own UPC-A barcodes, as they will inevitably conflict with the real ones!  All UPC-A barcodes are twelve digits (no characters!), and each of the four clusters has a purpose.

In the example above, the first digit (the '0') represents the Number System Character.  It identifies what category the product falls under (i.e. drugs, non-food, food, etc.)  This number is assigned by The Uniform Code Council.

Digits 2-6 (the '43100') are the manufacturers number (In the above example, all "Mead" products have a manufacturer number of 43100.  This is a number that is assigned by The Uniform Code Council. 

The next 5 digits (7-11) are the item number of the individual product for UPC identity for that product.  The '75024' above is often the model number for the product.  It is selected by the manufacturer, and is the registered with The Uniform Code Council.

The last digit (#12) is the check digit.  It is the result of a algorithm that is run on the first 11 digits.  Alpha Five has a function called CHKDIGIT that, with option 2 selected, can calculate the check digit.  As the name implies, the check digit is used to determine if the 12 digits entered into a field is a valid UPC.

I'll point out here, that while I say 'digits', all UPC's are stored in character fields (just like zip codes) because numeric fields would drop any leading zero's.

So, anyway, if your business revolves around retail, you'll want to use UPC-A.  If you are on the production end of retail, and would like information on acquiring a manufacturers number (digits 2-6), try visiting http:\\www.uc-council.org  for more information.

CODE39 (also referred to as CODE 3 of 9) is used in the manufacturing sector, and many other non-retail applications.  

It is a more versatile barcode than UPC-A in that it can be any length (barring the limits of both the scanner and the printer!), and it can contain characters and digits in any combination.  This makes it possible to barcode many different sources of data such as box count, product revision, P.O.. number, membership number (like Bally's!), employee number (as in a time clock!), and the like.  There is no council for CODE39, and barcode numbers need not be unique.

Once again, CODE39 is stored in a character field, and it's only other noteworthy point is that a code39 barcode must start with an * (asterisk) and end with an *, as shown below:

The asterisk should not be stored in the UPC field itself, but should be added at print time in a calculated field whose expression would be "*" + ALLTRIM(Part_No) + "*" for the fictional part number represented in the example above.

Code39 is easier to print than UPC-A, but I've taken a few steps to make it easier for you.

O.K., now that you've picked which format is appropriate for your purposes, we need to discuss fonts.  Why fonts, you ask?  Well, believe it or not, that's how you print a barcode.  You drag a field on your form, report, or label, and designate the font for the field as either UPC-A or CODE39.

Now, most people don't have these two fonts.  There are dozens of packages out there with a full array of barcode fonts.  Any will do the job, but most packages are in the $150 range.  Within these packages are two different categories, actual programs that will work with your *.dbf file and print labels outside of Alpha Five (not very desirable!), and packages of Windows fonts.  The problem I have with these packages is that they come with dozens of fonts (for other barcode formats) that you'll never use.  

I have found two free fonts, one UPC-A and one CODE39, that should more than satisfy any user or company with few limitations.  They are listed below, accordingly.  I have supplied the links to download them, and point out that, while they are free to use, there are some prerequisites set for them by the owners.  Please take a moment to read the terms.  As I read them, the CODE39 may be used free of charge, and the UPC-A can be used by individuals free of charge, but companies are requested to register for a nominal $10 fee.  A bargain considering the cost of fonts!

One last noteworthy comment before we start applying all this to Alpha FiveAlpha Five Version 5 allows ActiveX components to be bound to a field object.  This advancement in Alpha Five opens a world of possibilities to developers, barcodes not withstanding.  ActiveX barcodes would allow developers to select a great many settings for barcoding.  For example, the conversion shown below for UPC-A (I've written a function to make it easier for you) would be handled by an ActiveX *.dll internally.  The problem with ActiveX barcode packages is the cost.  Most are in the $500 range!

If you've made it this far, you've done the hard part!  Alpha Five makes setting this up easy!

SETTING UP UPC-A IN ALPHA FIVE:

First, you need a UPC-A font. Although several fonts are included in the zip file, you only need to install the one UPC-A.ttf font, but you can also install UPC-AHH.ttf font if you want the option available to print half height UPC-A's.  You also need to read the register.txt and readmeupca.txt files carefully.  As I say, commercial businesses must pay $10.  Instruction to install fonts are on the site this link takes you to.

Download UPC-A font

Great, now you have the font.  Let's download and unzip the simple sample I have prepared for you.  Just unzip the entire directory and open the database in Alpha Five.  The default directory is UPCA_EXAMPLE.

DOWNLOAD UPCA SAMPLE HERE!


First, let's look at the field rules for the lookup1.dbf.  You'll notice the UPC field is 12 characters.  There are four rules I recommend for a table that serves as a lookup for UPC's.  It is imperative that you create and maintain one master table that contains one record for every UPC, and that that this table's field rules enforce accurate data entry.  In our example, it will be the lookup1.dbf.  All future scans will be checked against this table for accuracy and existance.

1)  The UPC should be unique.  

2)  A template should be placed that only allows numbers in this character field, as shown below:

3)  Let's put in a validation that confirms that a valid UPC has been entered.  The formula below runs an algorithm on the first 11 digits of the UPC, then calculates what the twelfth digit should be.  If it doesn't match the one that was typed in, the user gets an "INVALID UPC!" message box.

4)  You'll note I have made all fields in the lookup table required so the lookup table is always complete.

O.K., that's it for field rules.  Let's look at the code tab on the control panel very briefly.  You'll notice a function called UPC_TO_FONT.  This function must be used every time you want to print or show the UPC using the font that you've just downloaded. You can copy it to any application you wish.  An example follows bellow.

Now, let's open the UPCA_EXAMPLE_FORM.  As you fan through the records, you'll notice these are actual items around my desk.  You can also enter some valid UPC's to test this example.

To see how this was set up, open the form in design mode.  Go to the form's calculated fields.  There is one calculated field called UPC_CALC.  It uses the new function to convert the valid UPC to the appropriate font characters.  It's use is simple, just UPC_TO_FONT(thenameofyour UPCfieldhere).

The calculated field was then dragged onto the form, an appropriate size was selected, the border was removed, a solid white background was selected, and the font was set as shown below:

The rest is pretty much self-explanatory...  You can place UPC's on shelf labels, forms, or whatever format you choose.  Remember that, while barcodes can be printed in other colors, black (NOT bold) is the surest bet.

SETTING UP CODE39 IN ALPHA FIVE:

First, you'll need a CODE39 font.  When you extract the zip file, you should read the readme.txt file, then install the font called Z3of9.ttf.

Download CODE39 font

Now you should download the simple example I have prepared for you, just unzip the entire directory and open the database in Alpha Five.  The default directory is CODE39_EXAMPLE.

DOWNLOAD CODE39 SAMPLE HERE!

First, let's look at the field rules for the lookup2.dbf.  The only field rules that need to be set are that all fields in a lookup should be required (keeping the lookup table complete), and that the part_no (from which we derive our barcode) should be unique.  It is imperative that you create and maintain one master table that contains one record for every UPC, and that that this table's field rules enforce accurate data entry.  In our example, it will be the lookup2.dbf.  All future scans will be checked against this table for accuracy and existance.

A check digit formula is available for CODE39, but it is rather complex.  Most CODE39 users don't use a check digit, myself included.

Now, lets look at the CODE39_EXAMPLE_FORM.  As you fan through these records, you'll probably pick out that these are fictional items in a fiction manufacturing plant.  In this case, a template could be set in the field rules for the part_no field, but this is optional as many part numbers follow no explicit template.

Opening the form in design mode, we see one calculated field, called UPC_CALC.  As I mentioned earlier, CODE39 requires an asterisk (*) at the start and finish points of the barcode.  The following expression was used on the calculated field, which adds the asterisk's:

The calculated field was then dragged onto the form, an appropriate size was selected, the border was removed, a solid white background was selected, and the font was set as shown below:

Keep in mind that, while UPC-A is a fixed number of 12 digits, CODE39 is limited only by the number of characters in the field, and the size of the media it is printed on.

This font doesn't print the part_no in a readable format automatically, as does the UPC-A font, so I have drop and dragged the part_no field itself, placing it just below the barcode.  This doesn't reflect the asterisks, but this doesn't matter as they are embedded in the actual barcode already.  Once again, an appropriate size was selected, the border was removed, and a solid white background was selected.

This font, by the way, doesn't reflect a space generated by a space bar press, so it you wish to reflect a space, use the tilde (~) sign in place of the space.

Charlie Crimmel from the message board suggested a nice idea. He pointed out that data identifiers are a great idea, especially if you are barcoding several different pieces of data. A "B" could precede a name badge UPC, a "P" could precede a P.O. number UPC, etc... Certainly worthy of consideration.

Again, CODE39 is very easy to use.  The rest is pretty much self-explanatory...  You can place UPC's on shelf labels, forms, or whatever format you choose.  Remember that, while barcodes can be printed in other colors, black (NOT bold) is the surest bet.

If you don't have a way to test your printed barcodes, I strongly recommend you read next months article on barcoding equipment BEFORE starting to use the barcodes in a printed format.  The simplest error will cause the barcode to fail.  Next month, I'll direct you to scanning equipment as low as $10, and equipment as high as $2500.

This is probably enough for one article, and probably enough for two headaches, but it really is much, much easier than it reads!