Jump to content

3 of 9 barcode (HR) with checkdigit


milind.vaze

Recommended Posts

Hello:

In address labels - we have to insert a 3 of 9 barcode (human readable) with check digit. Client has told us to start barcode number series beginnning with 200,00,000. Printing has to be done daily lots with barcode numbering continuing from the earlier lot.

 

Each barcode has to have 13 characters:

First 2 characters - alphabets 'EA'

Next 8 characters - number digits

Next 1 character - check digit

Next 2 characters - alphabets 'IN'

 

Other fields for address details are in Excel format.

 

Please guide.

 

Regards.

 

Milind Vaze.

Link to comment
Share on other sites

  • 4 weeks later...
Hello:

In address labels - we have to insert a 3 of 9 barcode (human readable) with check digit. Client has told us to start barcode number series beginnning with 200,00,000. Printing has to be done daily lots with barcode numbering continuing from the earlier lot.

 

Each barcode has to have 13 characters:

First 2 characters - alphabets 'EA'

Next 8 characters - number digits

Next 1 character - check digit

Next 2 characters - alphabets 'IN'

 

Other fields for address details are in Excel format.

 

Please guide.

 

Regards.

 

Milind Vaze.

Hello:

 

Formula in excel is available to generate the check digit for 3 of 9 barcode. Can this formula be converted for use in javascript to generate the barcode data (including prefix, check digit and suffix)?

 

Thanks with regards.

 

Milind Vaze

Link to comment
Share on other sites

Hello:

 

Formula in excel is available to generate the check digit for 3 of 9 barcode. Can this formula be converted for use in javascript to generate the barcode data (including prefix, check digit and suffix)?

 

Can it be converted to JavaScript from Excel? I don't think so. But if you know what the formula is, you can write it in JavaScript for FusionPro to use. I googled "3 of 9 barcode formula" and came across this website.

 

By referencing that website, I was able to come up with this function to create a human-readable barcode with a check digit:

function Encode(barcode) {    
   var map = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.',' ','$','/','+','%'];
   var check = 0;
   barcode = ToUpper(barcode);
   for (i in barcode)
       check += map.indexOf(barcode[i]);
   check %= 43;
   return barcode + map[check];
}

You can place it in your JavaScript Globals and call it from any rule in your template like so:

return Encode('20000000'); // returns 200000002

 

In regards to your original question, if you're creating a sequential batch of barcodes, you could assign a starting point in JavaScript Globals or OnJobStart like this:

var start = 20000000 - 1; // Minus one so the first record will be 20000000

 

Then your text rule would look like this:

var seq = FusionPro.Composition.inputRecordNumber + start;
return 'EA' + Encode(seq) + 'IN'; // returns EA200000002IN

Link to comment
Share on other sites

Hi Milind,

example attached.

I googled for an excel forumula for Mod43 check digit and got this. http://www.excelbanter.com/showthread.php?t=426855

The excel formula was applied to the eight digit number a check digit and the results were concatenated with the alpha characters.

 

In FusionPro the building block was used to create the 3of9 barcode and applied to the field. The second barcode is the same except the alphas were applied in a FusionPro rule.

 

Not sure if any of it is correct or what you are trying to achieve but the barcodes do scan.

 

Note: I haven't tried Steve's solution yet but I believe it would be a more exceptional solution to have the work/process all done in FusionPro.

 

Leo

3_of_9_Label_Test_3x4_FP.zip

Link to comment
Share on other sites

The excel formula was applied to the eight digit number a check digit and the results were concatenated with the alpha characters.

 

This is exactly what my 'Encode' function is doing.

By referencing that website, I was able to come up with this function to create a human-readable barcode with a check digit:

function Encode(barcode) {    
   var map = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.',' ','$','/','+','%'];
   var check = 0;
   barcode = ToUpper(barcode);
   for (i in barcode)
       check += map.indexOf(barcode[i]);
   check %= 43;
   return barcode + map[check];
}

 

I probably should have mentioned this before, but here's the actual breakdown of how the function works:

  • An array ('map') is used to hold the values of the possible check digits and barcode characters – I pulled these from the website I referenced in my previous post.
  • The 'check' variable is initialized at 0 and will be incremented to determine the check sum
  • The value of the barcode is set to uppercase
  • Each character in the barcode is referenced against the 'map' array to determine how much to increment the check sum ('check').
     
    For example: if the 'barcode' input is "EA", the for loop uses the 'map' array to determine the position of 'E' (map.indexOf('E') == 14) and adds 14 to the check sum. Then it gets the value of 'A' (map.indexOf('A') == 10) and adds 10 to the check sum. So the check sum for "EA" is "24".
     
  • Then you need to do a mod 34 of the check sum:
    check = check % 34;
    


    or

    check %= 34
    


     
    In the case of the "EA" example, 24 % 34 is 24

  • Finally the mod34 is referenced against the 'map' array to determine with value to return for the "check character" and appended to the end of the barcode.
     
    // map[24] == 'O'
    return barcode + map[check]; // returns EAO
    


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...