Zum Hauptinhalt gehen

Suche

Suche

Barcode Interleaved - Mod11 Check Digit

Kommentare

10 Kommentare

  • Avatar
    Ian Cummings
    Moderator

    BarTender supports a range of check digit functions in VB script, some of which are based on Mod 11, which is a very general, non-specific term.  If one of these functions is right for you then you can use it in the below manner, which references the named data source value you set for the data part of the barcode.

     

    ISO7064Mod11_10(Format.NamedSubStrings("barcode").Value)

    0
  • Avatar
    Legacy Poster

    BarTender supports a range of check digit functions in VB script, some of which are based on Mod 11, which is a very general, non-specific term.  If one of these functions is right for you then you can use it in the below manner, which references the named data source value you set for the data part of the barcode.

     

    ISO7064Mod11_10(Format.NamedSubStrings("barcode").Value)

     

    Thanks for the fast answer!

     

    i tried it but don't make the digit that the customer want.

     

    They already have the software with formula to calculate the check digit but is for the inkjet printer and now they want to do it with a printer that uses Bartender .

     

    Here is the code that the customer uses:

    Private Function DV_PID(ByVal numPedido As String) As Integer
        Dim numSoma  As Long
        Dim numResto As Integer
        
        numSoma = 0
        numSoma = numSoma + Val(Mid(numPedido, 11, 1)) * 2
        numSoma = numSoma + Val(Mid(numPedido, 10, 1)) * 3
        numSoma = numSoma + Val(Mid(numPedido, 9, 1)) * 4
        numSoma = numSoma + Val(Mid(numPedido, 8, 1)) * 5
        numSoma = numSoma + Val(Mid(numPedido, 7, 1)) * 6
        numSoma = numSoma + Val(Mid(numPedido, 6, 1)) * 7
        numSoma = numSoma + Val(Mid(numPedido, 5, 1)) * 8
        numSoma = numSoma + Val(Mid(numPedido, 4, 1)) * 9
        numSoma = numSoma + Val(Mid(numPedido, 3, 1)) * 10
        numSoma = numSoma + Val(Mid(numPedido, 2, 1)) * 2
        numSoma = numSoma + Val(Mid(numPedido, 1, 1)) * 3
        
        numResto = numSoma Mod 11
        DV_PID = IIf(numResto = 0 Or numResto = 1, 0, 11 - numResto)
        
    End Function
     
    Below some codes that hey already make a check digit:
    90122620215-8
    90124862214-1
    90124846597-6
     
    I need to generate in bartender this sames mod11 check digits and i don't understand anything about programming =/
    0
  • Avatar
    Ian Cummings
    Moderator

    You just need to write the same code, but adapted to the VB script syntax.

     

    VB Script uses a variant type for variables so the below dimension command example is all you need:

     

    Dim numSoma

     

    For each summed calculation something like the below should do it:

     

    numSoma = numsoma + (Mid(numPedido,11, 1) * 2)

     

    Of course if numPedidio is really just the value of a named data source then it could look like the below:

     

    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,11, 1) * 2)

     

    The last bit should be very similar:

     

    numResto = numSoma Mod 11
    value = IIf(numResto = 0 Or numResto = 1, 0, 11 - numResto)
    0
  • Avatar
    Legacy Poster

    You just need to write the same code, but adapted to the VB script syntax.

     

    VB Script uses a variant type for variables so the below dimension command example is all you need:

     

    Dim numSoma

     

    For each summed calculation something like the below should do it:

     

    numSoma = numsoma + (Mid(numPedido,11, 1) * 2)

     

    Of course if numPedidio is really just the value of a named data source then it could look like the below:

     

    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,11, 1) * 2)

     

    The last bit should be very similar:

     

    numResto = numSoma Mod 11
    value = IIf(numResto = 0 Or numResto = 1, 0, 11 - numResto)

    Thanks a lot

     

    Here is my code

    Dim numSoma
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,11, 1) * 2)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,10, 1) * 3)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,9, 1) * 4)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,8, 1) * 5)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,7, 1) * 6)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,6, 1) * 7)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,5, 1) * 8)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,4, 1) * 9)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,3, 1) * 10)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,2, 1) * 2)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("barcode").Value,1, 1) * 3)
    numResto = numSoma Mod 11
    value = IIf(numResto = 0 Or numResto = 1, 0, 11 - numResto)
     
    But bartender send-me an error "line 1: value = dim numsoma: sintax error".
    0
  • Avatar
    Ian Cummings
    Moderator

    DId you set this to be a multi-line or event based VB Script?  The error indicates to me that it's set to a single line expression.

    0
  • Avatar
    Legacy Poster

    DId you set this to be a multi-line or event based VB Script?  The error indicates to me that it's set to a single line expression.

    thanks, its working without error but now the check digit is very big.

     

    my barcode: 90122620215

    check digit generated: 1179656

     

    The check digit must to be only one digit. 

     

    Sorry for all this questions but i really know nothing about this

    0
  • Avatar
    Ian Cummings
    Moderator

    Okay, try this:

     

    Dim numSoma, numResto
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,11, 1) * 2)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,10, 1) * 3)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,9, 1) * 4)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,8, 1) * 5)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,7, 1) * 6)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,6, 1) * 7)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,5, 1) * 8)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,4, 1) * 9)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,3, 1) * 10)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,2, 1) * 2)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,1, 1) * 3)
    numResto = numSoma Mod 11
    value = IIf(numResto = 0 Or numResto = 1, 0, 11 - CInt(numResto))
    
    0
  • Avatar
    Ian Cummings
    Moderator

    Ooops, I named my data source btBarcode, so you want to change that back to "barcode" if that's what you're using in your document.

    0
  • Avatar
    Legacy Poster

    Okay, try this:

     

    Dim numSoma, numResto
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,11, 1) * 2)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,10, 1) * 3)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,9, 1) * 4)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,8, 1) * 5)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,7, 1) * 6)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,6, 1) * 7)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,5, 1) * 8)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,4, 1) * 9)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,3, 1) * 10)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,2, 1) * 2)
    numSoma = numsoma + (Mid(Format.NamedSubStrings("btBarcode").Value,1, 1) * 3)
    numResto = numSoma Mod 11
    value = IIf(numResto = 0 Or numResto = 1, 0, 11 - CInt(numResto))
    

     

    Man... i don't know how i can say that but you are an angel!! haha
     
    Thanks a lot! it works very fine! =D
     
    I tested with a lot of codes that the our customer sent to us to compare and everything is perfect!
     
    The internet needs more people like you.
     
    Thanks again and have a nice a day!
    0
  • Avatar
    Ian Cummings
    Moderator

    You're very kind; I'll give my halo and extra polish today.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.