Link to home
Start Free TrialLog in
Avatar of rodneygray
rodneygrayFlag for United States of America

asked on

Code 128 Application Identifiers : Can barcode scanner pass as (

A code 128 barcode segments data by using application identifiers. One of the identifiers is 3202. In the barcode, the 3202 is enclosed in parentheses ie: (3202). This AI tells me there are 6 digits following the (3202) and that the number has two decimal positions.

When I read a barcode with my barcode scanner, the "()" are not included with the scan. I can see the application identifier (such as  the 3202 pounds, net weight, 6 digits, 2 decimals). However, it is not enclosed in parenthesis.

I am trying to write code that will parse the barcode data, find the AI's and determine what information follows.
(01)90078155006458(3202)005032
Find 1st (
Find )
Extract data from between ().
This tells me what data and the size of the data field that follows
Now I should be able to extract the info from the barcode using the information I have.

The problem is, the parentheses do not come thru with the barcode.
Can I setup my scanner to expose this data
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

> Can I setup my scanner to expose this data

I guess so. Get hold of or download the manual which usually contains a lot of pages with specialized barcodes which you scan to program the scanner to behave differently.

/gustav
>> ... read a barcode with my barcode scanner, the "()" are not included with the scan ...

Can you post an image of a sample bar-code, so we can see just what is encoded in that bar-code?

This should tell us whether or not the "(" and ")" characters are encoded in the bar-code.
If not, it may be a restriction of whatever code you are using to generate the bar-code, or it may be that you are mandating a Code 128 subset which does not support non-numeric characters.
Rodney,

 As has been said, you'll need to get the manual for the scanner your using in order to control the output.    

Your really not looking for the ( ), but the FNC1 code, which denotes that the data that follows is an application identifier.   Decoding a 128 bar code with AI's is also a bit further complicated by the fact that if the AI data is fixed, another FNC1 code does not need to appear for additional data.

 So the easy way is to get the scanner to output the ()'s

Jim.
Avatar of rodneygray

ASKER

First, thanks for all the prompt replies and useful information. I had no idea on how to proceed with this project. You have all given me useful information. I will post a barcode screenshot later today.

To summarize all three comments, reading barcodes and decoding data begins with the printed barcode. In order to scan the barcode and extract AI data,  the AI must be enclosed within () on the printed barcode. However, per Jim, there is an additional caveat related to FNC1 codes. I will have to research that.

As the barcode is generated by software that is outside my control (I can't change output), I have to continue with my original code which extracts data based upon positional parameters. This works fine for company produced barcodes. However, we receive product from other vendors and that data can vary based upon the vendor label format. I wanted to write code that would extract data from any Code 128 barcode, extracting data based upon AIs. It looks like I will have to determine positional parameters and AIs for each company we receive barcoded product from and extract data based on those parameters.  That's a very inflexible system.

Has anyone ever written code for reading barcodes and extracting data based upon AI's? Or, can you point me in the direction for information concerning how to do this?
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Jim. The brute force method is what I will have to use. Because I do not have the luxury of having the () embedded in the I will create a table for each company we receive product from. I will enter the beginning/ending position and data type for each column in the barcode. The first data set that is in the barcode is the organization id. This is a fixed field. I can extract the org id an then pull parameter data from the barcode.
I'm no expert with Code 128 / EAN 128 bar codes, or Application Identifiers, but (partly so I can try to understand this) I've done a bit of research.

It would seem that the "(" and ")" characters are not expected to be present in bar-codes, but are conventionally used with some bar-code generation software packages to indicate an AI; the package then determines (from the value of the enclosed AI) whether or not to insert a FNC1 character in the generated bar-code at that point.

There are a number of defined AIs; some are fixed length, others are variable length.
With the fixed-length ones, it is easy to determine where the next AI (if present) should start.
With the variable length ones, an additional FNC1 character needs to be inserted in front of any following AI.

This is best illustrated by example.
I've taken some of the bar-code samples from the the "GS1 AI (Application Identifier) & Element String Specifications" page of the Id Automation web site - see http://www.idautomation.com/barcode-properties/definitions/gs1-application-identifiers.html and annotated them with decodes of the actual bar-code symbols:

  User generated imageUser generated imageUser generated image
 

 

With all of these, a FNC1 character follows the initial Start character (start subset C in each case) to indicate that AIs are present.
It is only with the third sample, where the first AI is variable-length, that an additional FNC1 character is inserted to indicate the start of the next AI.

All three samples include check-sum characters before the trailing STOP character.
The second and third samples include 'change subset code' characters because some of the data fragments do not contain even numbers of (paired) integer values.
<<It would seem that the "(" and ")" characters are not expected to be present in bar-codes, but are conventionally used with some bar-code generation software packages to indicate an AI; the package then determines (from the value of the enclosed AI) whether or not to insert a FNC1 character in the generated bar-code at that point.>>

 That's the jist of it.  () is not in the actual code itself, but is typically in the human readable.   Scanners them selves also have a wide range of options and some can insert it into the data as if it was scanned that way.

So depends on the scanner.  But if your not controlling it, then it would be best to assume your going to see the FNC1 character, know the rules for applying it, and brute force parse the resulting string for data.

In order to do so correctly, you have to know all the AI's and what type of data they represent (fixed or variable).

Jim.
>> ... it would be best to assume your going to see the FNC1 character, know the rules for applying it, and brute force parse the resulting string for data ...
>> ... In order to do so correctly, you have to know all the AI's and what type of data they represent (fixed or variable) ...


Agreed.
Thank you Gentlemen for going above and beyond in answering my questions. I appreciate your interest and timely answers to my query. I will look into the information you have so generously provided. I will post what I find. Thanks again!