Question about check digits

Questions, comments and suggestions concerning VintaSoft Barcode .NET SDK.

Moderator: Alex

Post Reply
javieron
Posts: 4
Joined: Thu Apr 03, 2014 11:30 am

Question about check digits

Post by javieron »

Hi I have downloaded the demo of your software "Barcode Writer".

I have a small question about the use of it.

For example when i doing a code Code128 - gs1 when for example the chain is (00)38456789000000009 I have to calculate the last digit.

For example the Bartender application, automatically fills me with the last digit control character needed in this case 1, staying in final form this chain
(00) 384567890000000091

There any method or way to calculate the check digit with your Sofware?

Thanks for everything.
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Question about check digits

Post by Alex »

Hello,

Code128 barcode always has checksum character but checksum character is not included in the barcode value. Why do you need checksum character? Please send me more info about your needs.

Best regards, Alexander
javieron
Posts: 4
Joined: Thu Apr 03, 2014 11:30 am

Re: Question about check digits

Post by javieron »

Hello again ¡

View that web

http://www.gs1-128.info/sscc-18/

I Spoke About the last digit ( purple )


In Gs1-128 SSCC Check Digit its visible and included in Barcode Value.


Thanks for all again ¡ :)
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Question about check digits

Post by Alex »

Thank you for information, I have understood you incorrectly.

SSCC-18 barcode is GS1-128 barcode with application identifier equal to 00. GS1-128 barcode is Code128 barcode with value in GS1 format.

SDK can generate Code128 and GS1-128 barcodes. Current version of SDK needs 18 digits (17 value digits + 1 check digit) for generating SSCC-18 barcode and you need calculate check digit by yourself.

Here is C# code that allows to calculate check digit of SSCC-18 barcode:

Code: Select all

/// <summary>
/// GS1 General Specifications Version 10.
/// 7.10.1. Standard Check Digit Calculations for GS1 Data Structures.
/// </summary>
public static int CalculateStandardCheckDigit(string barcodeValue)
{
    int checkSum = 0;
    for (int i = barcodeValue.Length - 1; i >= 0; i -= 2)
        checkSum += barcodeValue[i] - '0';
    checkSum *= 3;
    for (int i = barcodeValue.Length - 2; i >= 0; i -= 2)
        checkSum += barcodeValue[i] - '0';
    checkSum = checkSum % 10;
    if (checkSum == 0)
        return 0;
    return 10 - checkSum;
}
We will add the ability to calculate check digit of SSCC-18 barcode automatically in next version of SDK.

Best regards, Alexander
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Question about check digits

Post by Alex »

Hello,

In version 8.0.0.7 we have added the ability to calculate or check the control digit for GS1 barcode with the following Application Identifiers: SSCC18(00), GTIN(01-02), GDTI(253), GSIN(402), (410-415), GRAI(8003), GSRN(8018). Please use this version and let me know if you will have any question or problem.

Best regards, Alexander
javieron
Posts: 4
Joined: Thu Apr 03, 2014 11:30 am

Re: Question about check digits

Post by javieron »

Yes ¡¡ Don´t worry about that ¡

I just recive your E-mail with the registered version.

Now i´m triying to view the way to autocalculate the digit.


Dim EanBox as String = "1842517400059" ' Only 13 digits with no Check

Dim Gs1_02 As New Vintasoft.Barcode.GS1.GS1ApplicationIdentifierValue(applicationIdentifiers(2), EanBox)


But does´nt work. What is the Code to check or generate the digit ?
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Question about check digits

Post by Alex »

Now i´m triying to view the way to autocalculate the digit.

Dim EanBox as String = "1842517400059" ' Only 13 digits with no Check
Dim Gs1_02 As New Vintasoft.Barcode.GS1.GS1ApplicationIdentifierValue(applicationIdentifiers(2), EanBox)

But does´nt work. What is the Code to check or generate the digit ?
You need provide 14 symbols (digits) if you want to generate GS1 barcode with Application Identifier 1. Barcode generator will check the check digit in the barcode value if you will provide digit in 14-th position of barcode value. Barcode generator will generate the check digit for the barcode value and add the check digit to the barcode value if you will provide symbol 'C' in 14-th position of barcode value.

Here are some examples:
  • Input value: 1842517400059
    Output: Barcode generator will raise an exception because input value contains 13 digits
  • Input value: 18425174000590
    Output: Barcode generator will check the check digit and raise an exception because check digit is incorrect
  • Input value: 18425174000592
    Output: Barcode generator will check the check digit and generate barcode image because check digit is correct
  • Input value: 1842517400059C
    Output: Barcode generator will generate the check digit, replace 'C' symbol by check digit and generate barcode image with value "18425174000592"
Best regards, Alexander
javieron
Posts: 4
Joined: Thu Apr 03, 2014 11:30 am

Re: Question about check digits

Post by javieron »

Ok ¡¡ I´m going to try It ¡

Thanks for all ¡
Post Reply