Help save net neutrality! Learn more.
Close

Format of the Barcode strings?

Help
klsh
2004-03-12
2004-03-12
  • 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:
      5|s$

      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
      SaberLogic

       
    • Brian Ellis

      Brian Ellis - 2004-03-12

      Sorry about that, when we build our barcode it should be:
      5|s$

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

      Brian
      SaberLogic

       
    • 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

      <5|s$>

      Brian
      SaberLogic

       
    • 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 $

      Brian
      SaberLogic

       
    • 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 (www.bizfonts.com).  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 (http://www.adams1.com/pub/russadam/128code.html).  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: http://user.it.uu.se/~jan/barfonts/\) 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:
      http://www.adams1.com/pub/russadam/128code.html
      // 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", ")",
      "10","*",
      "11","+",
      "12",",",
      "13","-",
      "14",".",
      "15","/",
      "16","0",
      "17","1",
      "18","2",
      "19","3",
      "20","4",
      "21","5",
      "22","6",
      "23","7",
      "24","8",
      "25","9",
      "26",":",
      "27",";",
      "28","<",
      "29","=",
      "30",">",
      "31","?",
      "32","@",
      "33","A",
      "34","B",
      "35","C",
      "36","D",
      "37","E",
      "38","F",
      "39","G",
      "40","H",
      "41","I",
      "42","J",
      "43","K",
      "44","L",
      "45","M",
      "46","N",
      "47","O",
      "48","P",
      "49","Q",
      "50","R",
      "51","S",
      "52","T",
      "53","U",
      "54","V",
      "55","W",
      "56","X",
      "57","Y",
      "58","Z",
      "59","[",
      "60","\&quot;,
      "61","]",
      "62","^",
      "63","_",
      "64","'",
      "65","a",
      "66","b",
      "67","c",
      "68","d",
      "69","e",
      "70","f",
      "71","g",
      "72","h",
      "73","i",
      "74","j",
      "75","k",
      "76","l",
      "77","m",
      "78","n",
      "79","o",
      "80","p",
      "81","q",
      "82","r",
      "83","s",
      "84","t",
      "85","u",
      "86","v",
      "87","w",
      "88","x",
      "89","y",
      "90","z",
      "91","{",
      "92","|",
      "93","}",
      "94","~"
      );

      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
      position.
      While CurrentCharacterPosition <= DataLength Do
      (
          Local StringVar CurrentCharacter := Mid(Data, CurrentCharacterPosition,
      1);
          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/2)-1)*CurrentCharacterPosition;
              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.

      Adam
      SaberLogic

       

Log in to post a comment.