× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Michael,

In my experience FNC1 (which is what I think you mean by "/FNC") is not required as a separator for every AI in a GS1-128 (or UCC/EAN 128 in the old days) bar code.  The FNC1 is only needed before an AI when the preceding data is variable-length.

For example, AI 21 (serial number) can be between 1 and 20 digits.  Since it is variable in length, if there's another AI after it, the FNC1 must be there to designate the end of the variable-length string.

On the other hand, AI 01 (GTIN) is always 14 digits, so its not necessary to have FNC1 after it, even if there is another field that follows.

My strategy would be to write a finite state machine (FSM) that works with the following pseudocode.

1) Skip the initial FNC1

2) Read 2 characters.   This provides enough information to know the "class" of AI.

3) Have a list of AI classes (this can be a list in your program, or found in a file, whatever makes sense to you.  Personally, I used a table in my program because it ran faster, and it didn't change frequently).  This should tell you based on the AI whether there are additional characters needed to get the remainder of the AIs.  (AIs that start with 23, 24, 25, 31, 32, 33 and some others require extra characters).

4) Read any additional characters noted in step 3 so that you have the full AI.

5) Look up the length of data needed for that AI.  Again, this would be in a list, maybe in your program, maybe in a file.  This should tell you whether there's a fixed length, or whether its variable length.

6) Read the data for that AI.  (using the length from step 5, and looking for the FNC1 to terminate variable-length fields if appropropriate.)  You now know the AI and the data that goes with it.

7) Based on which AI was given, store the data somewhere (maybe a data structure?) if its useful to you.  If its extraneous data, discard it.

8) Repeat steps 2-7 until you've read all data in the bar code.


With this approach, there's no need to assume the AIs will be in any particular order, as long as they exist, they'll be handled appropriately.  If the customer makes changes, adds new fields, etc, they won't hurt your application (though, they may be ignored if they are fields you weren't expecting.)

-SK


On 11/21/2018 8:05 AM, Michael Schutte wrote:
I'm looking for some ideas for programming techniques dealing with barcodes
that contain multiple /FNC and AI Codes.

I had a customer request serial numbers to be stripped from a barcode that
contained 3 different segments. For example.. (the parenthesis are not in
the scanned barcode. Instead that is the /FNC followed by the AI code
"93", "92", "21"). Important note, the RF Devices we use to scan these
barcodes, convert the /FNC (GS group separator) to a pipe |. This is done
because the /FNC trashed the display file screen.

(93)XXXX000000XX(92)C(91)1E1613161313

Issue one we have is with the customer. They cannot guarantee the order of
the segments. And the lengths of the elements can change. This is their
preferred format, however, said their vendors can choose to do something
different. That tends to make things difficult on us (a 3 party
warehouse).

Issue two we have is with the original developer of the process, decided to
grab the first two characters of the string. Then used hard-coded
programming to see if the string started with 93, 92, 91. Then if it did,
the program searched for the 91 segment and substringed out the serial
number.

With this being hardcoded, the customer then decided they wanted to change
91 to 21. So we had to change the program seek for 21 too.

Now, the customer is changing the 93. The 93 is now going to be 240. 3
characters instead of 2. So again here I am looking to modify the process
again.

I was thinking there has to be a better way. So I was seeking to see if
anyone else has developed a better solution.

I'm thinking of doing a translation table of some kind. I would read
through the table, then check to see if the FNC (or pipe) + AI Code exists
in the barcode. In this example, I just need what is after the 91 or 21 and
to the end of the string or to the next FNC (or Pipe).


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.