SourceForge has been redesigned. Learn more.

Format of the Barcode strings?

  • klsh

    klsh - 2004-03-12

    Looking at the code it seems the employee number must start with a $. Is this correct?

    I don't have the advc128d font and can't test the demo pdf's. Can I print these with code 39 fonts?

    2|s$, Clock In / Select Yourself

    • Brian Ellis

      Brian Ellis - 2004-03-12

      Hi klsh,

      The employee number does not have to start with a $. The $ is what we call a barcode signifier. These are defined in the config file. If you look in the config file you will see a  setting called main_selection_signifier = $ This defines what character is used by the system to know when a barcode is being passed to it. So if you have this set to the $, you cannot use the $ in your employee number. This may still be confusing so lets use an example. Lets say that you have an employee number 305.

      The generic barcode formula for clock in is <main_selection_signifier><employee_num><seperator_signifier><clockin_and_select_signifier><main_selection_signifier>

      So in our example, we have the following defined in our config file (this is the way that it is defined by default):
      main_selection_signifier = $
      seperator_signifier = |
      clockin_and_select_signifier = s

      So when we want to build our clockin barcode, it would be:

      I hope this clears up the employee numbering system. Feel free to post any additional questions and I will get back with you ASAP.

      As far as using different barcode fonts. The system doesnt really care which barcode font you are using, as long as your barcode reader supports it. We choose to use code 128 because it condensed much better, but you are welcome to use any code you wish (again as long as your reader supports it). Unfortunately, those PDF's didnt come out quite right. So you will have to run the Crystal Report to get the proper barcodes to print out, again changing the barcode font if you don't use the one it currently has.

      As a side note, saberlogic_ae will be posting a response in this forum later of how you can use a GPL'd code 128 font in Crystal Reports.

      I hope this helps! Again, please feel free to ask any questions you may have. Some of the documentation (read: all) is a little sparse :) so anything you dont understand feel free to ask.

      Brian Ellis

    • Brian Ellis

      Brian Ellis - 2004-03-12

      Sorry about that, when we build our barcode it should be:

      Not quite sure where the rest of that went...


    • Brian Ellis

      Brian Ellis - 2004-03-12

      Ahhhhh! There is a strange issue with sourceforge not taking the first part of the barcode. It must not be properly escaping comments anywho, here is the format of the barcode, just remove the <>'s



    • Brian Ellis

      Brian Ellis - 2004-03-12

      Okay this is getting old. Apparently it really doesnt like my comment. One more time, this time pull all of the spaces out to get the general barcode format

      $ 3 0 5 | s $


    • klsh

      klsh - 2004-03-12

      OK this helps a lot. I appreciate the quick response. I'm looking at this right now.

    • Adam Ellis

      Adam Ellis - 2004-03-12

      I did not realize that the PDFs would not embed the fonts into the document.  Doesn't make it a very "Portable Document Format", does it? ;)

      Anyway, the output you are seeing for the "Clock In / Select Yourself" barcode is actually generated from a Crystal UFL / font distributed by ID Automation (  To elaborate on Brian's explanation...

      $ 2 | s $ ,

      The first and last characters of this statement are stop and start characters as defined in the Code 128 specification (  The comma is a checksum also derived from this specification.  The rest of the text is just regular text.

      To use Code 39, all you need is the font (you can get a GPL'ed one from here:\) and redo the formula in Crystal to have an * for the start / stop characters.  You do not need any checksum.  i.e. (added additional spaces so the SourceForge would not mangle the message up)

      " * $ " + {employees.emp_id} + " | s $ * "

      As Brian had mentioned, Code 128 is much more space-efficient and, in turn, scans way better.  As an alternative to the proprietary advc128d font, I have been working on a Crystal formula so you can use the GPL'ed code 128 as linked above.  Note that I just pieced this together last week and may still have some bugs.  Ultimately, I want to make this a UFL, but for right now just paste it into the formula editor:
      // Code 128 Construction
      // Reference Code128 Specification Here:
      // AE - 3/1/04

      // This is the string that is to be converted to a bar code
      // Eventually this should be what is passed into a function.
      Local StringVar Data := "$SHOP%S$";

      // Where is the ASCII position for start & stop characters?
      // Should always be start = 104 and stop = 106
      Local NumberVar Start := 104;
      Local NumberVar Stop := 106;

      // This table holds that ASCII mappings for all of the Code128b
      // characters.
      Local StringVar Array Code128bTableOfCharacters := MakeArray (
      "0", " ",
      "1", "!",
      "2", "",
      "3", "#",
      "4", "$",
      "5", "%",
      "6", "&",
      "7", "'",
      "8", "(",
      "9", ")",

      Local NumberVar DataLength := Len(Data);
      Local NumberVar CurrentCharacterPosition := 1;
      Local NumberVar RunningChecksumTotal := Start; // Set to 'Start' position
      since that is added into the checksum
      Local StringVar ChecksumCharacter = "";

      // This section determines the 128b ASCII value for each character times its
      While CurrentCharacterPosition <= DataLength Do
          Local StringVar CurrentCharacter := Mid(Data, CurrentCharacterPosition,
          Local NumberVar x := 2;
          While x <= 188 Do // Use 188 since there are 94 rows and 2 columns -
      Crystal does not do multidimensional
              If CurrentCharacter = Code128bTableOfCharacters[x] Then
                  RunningChecksumTotal := RunningChecksumTotal +
              x := x + 2; // Add 2 in order to go to next "row"
          CurrentCharacterPosition := CurrentCharacterPosition + 1;

      // Modulus 103 checksum
      RunningChecksumTotal := Remainder (RunningChecksumTotal, 103); // This is
      part of the 128 specification - including hardcoding the 103

      // Determine character that corresponds to this modulus 103 checksum
      Local NumberVar x := 2;
      While x <= 188 Do
          If RunningChecksumTotal = ToNumber(Code128bTableOfCharacters[x-1]) Then
              ChecksumCharacter := Code128bTableOfCharacters[x];
          x := x + 2;

      // Start & stop are adjusted by 97 to make human-readable
      Start := Start + 97;
      Stop := Stop + 97;

      Chr (Start) + Data + ChecksumCharacter + Chr (Stop)

      Hopefully SourceForge does not mangle up the formuals too bad.  If so, I can just upload them.



Log in to post a comment.