Aller au contenu principal

Recherche

Recherche

Modulo 103 script

Commentaires

18 commentaires

  • Avatar
    Peter Thane

    I am not sure that is possible.

    However, if you right click on the field you can use the Create Component option to create a label component that contains the script that you can quickly add to other labels. If multiple computers need access to this component to create labels (not use as fields on a saved label stay on that label) then you can link your Components folder location via the File Locations pane in Administration Console, although you need to make sure you save your component to that location after you have a mapped it to a shared location. 

     

     

    1
  • Avatar
    Lewis Ragonick

    thank you for getting back,  Have been trying to include this script into bartender but after 10 days I could really use some insight please

     

    Next
        checkSum = checkSum Mod 103
        checkDigit = Mid(mappingSet, checkSum + 1, 1)
        Code128C = Chr(202) + Code128C + checkDigit + Chr(203) + Chr(205)

    I have been trying to achieve the goal of producing a check digit based on modulo 103 

    1
  • Avatar
    Peter Thane

    What are the other characters you are trying to encode? Is the 202 supposed to a Function 1 but not sure on the 203 and 205 as they look like they could be switch subset commands which makes no sense as there no additional characters. 

    Personally I would make the check digit calculation a separate string to the balance of the code as per the attached image. I have named the main element "code" so I can easily reference this in the VB

     

    0
  • Avatar
    Lewis Ragonick

    Happy New Year Peter- Is it possible to send you a more detailed layout privately? Or if you have the time or laying around would you be able to provide me or guide me in the right visual script. This would make best sense as you explained, so it would be data then Visual scprit producing check digits(pair) at the end. Really appreciate your patience an time

    0
  • Avatar
    Peter Thane

    What are you actually trying to do? A code 128 barcode in BarTender will automatically have a Modulo 103 check digit appended to it in the barcode itself but that will not be visible in the Human Readable. Also as asked above what CHRs are you trying to add and for what purpose? 

    A simple bit of VB to add a Modulo 103 check digit to a named data source called "code", as above for example would be

    Value = .....(double click on the Named Data Source in the column on the right)

    Value = Value Mod 103

    However, this does not include any weighting on the characters which maybe needed and just applies the Mod to the number in the Code field.

     

    0
  • Avatar
    Lewis Ragonick

    Sorry for my confusion .

    The check digit of the string to be displayed via visual script, once the appended check digit is included i want to repeat another occurrence of what the new (check digit) value would be for the new string with the appended (check digit). Im using the PPMod97 only as an example type since it displays what would be a 2 digit check number.

    example. 123456 has a check digit of 8 based on the modulo 103.. leaving new string to be 1234568

    now i want the modulo 103 of 1234568 which is 3 leaving the new string value as 123456783 

    24 characters in total with AI identifier 

    0
  • Avatar
    Peter Thane

    Sorry, so you want to actually calculate what the standard Code128 Modulo 103 check digit would be and then add an extra Modulo 103 CD to the end of the string? 

     

    0
  • Avatar
    Lewis Ragonick

    Yes, thank you

    0
  • Avatar
    Peter Thane

    To calculate the standard Code-128 check digit is going to require you to create some code that will apply the base and weighting for each character you and then sum these together so you can then apply the Modulo 103 to it.

    I am not an expert but I believe this check digit is calculated as follows

    Base Number which is dependent on the subset character set used (eg Subset C = 105)

             plus for each character pair in the string 

    The number of that character pair multiplied by its location in the string, ie 654321 in Subset C would be 105 + (65 x 1) + (43 x 2) + (21 x 3)  

    0
  • Avatar
    Lewis Ragonick

    Anyone with knowledge on creating a code please chime in as this is where I would run out of gas. Thank you so much Peter for clarifying my thoughts into text, you truly are a hero.

    0
  • Avatar
    Peter Thane

    There is probably an easier way to do it but you could do something like this (I made the rest of the code a named substring called thecode for ease of reference), repeating the 2 lines for Value6 to Value12 and then adding the those to the final string

    Value = Format.NamedSubStrings("thecode").Value

    Value1 = Left(Value,2)

    Value1 = Value1 

    Value2 = Mid(Value,3,2)
    Value2 = Value2 * 2

    Value3 = Mid(Value,5,2)
    Value3 = Value3 * 3

    Value4 = Mid(Value,7,2)
    Value4 = Value4 * 4   

    Value5 = Mid(Value,9,2)
    Value5 = Value5 * 5 

    Value = 105 + Value1 + Value2 + Value3 + Value4 + Value5 

    Value = Value Mod 103

    0
  • Avatar
    Lewis Ragonick

    Also Peter l, wanted to ask if you can help me appropriate the correct lines in a 105 custom script vs the Modulo 10 you wrote that I seen on an existing post please.

    Value = Format.Objects("Modulo11").Value

    Value = Replace(Value, "X", "7")
    Value = Replace(Value, "Z", "9")

    0
  • Avatar
    Lewis Ragonick

    can you tell me what is missing from the code plz as my results are not matching up?

    Value = Format.NamedSubStrings("HOOPS").Value

    Value1 = Left(Value,2)

    Value1 = Value1 

    Value2 = Mid(Value,3,2)
    Value2 = Value2 * 2

    Value3 = Mid(Value,5,2)
    Value3 = Value3 * 3

    Value4 = Mid(Value,7,2)
    Value4 = Value4 * 4   

    Value5 = Mid(Value,9,2)
    Value5 = Value5 * 5 

    Value6 = Mid(Value,2,2)
    Value6 = Value6 * 6 

    Value7 = Mid(Value,3,2)
    Value7 = Value7 * 7 

    Value8 = Mid(Value,5,2)
    Value8 = Value8 * 6 

    Value9 = Mid(Value,7,2)
    Value9 = Value9 * 9 

    Value10 = Mid(Value,9,2)
    Value10 = Value10 * 10 

    Value11 = Mid(Value,2,2)
    Value11 = Value11 * 11

    Value12 = Mid(Value,3,2)
    Value12 = Value12 * 12 

    Value = 105 + Value1 + Value2 + Value3 + Value4 + Value5 + Value6 + Value7 + Value8 + Value9 + Value10 + Value11 + Value12

    Value = Value Mod 103

    0
  • Avatar
    Peter Thane

    The Mid(Value,X,2) command is an instruction to take 2 characters from position X and so needs to go up by 2 for every line.

    So Value6 = Mid(Value,2,2)

    should be

    Value6 = Mid(Value,11,2)

    Value7 = Mid(Value,13,2)

    etc

     

     

    0
  • Avatar
    Lewis Ragonick

    Thanks a bunch for your patience with me... I have completed the code but i am getting 22 as the check digit but the reader app shows it should be 39. Please verify 

    Value = Format.NamedSubStrings("HOOPS").Value

    Value1 = Left(Value,2)

    Value2 = Mid(Value,1,2)
    Value2 = Value2 * 2

    Value3 = Mid(Value,3,2)
    Value3 = Value3 * 3

    Value4 = Mid(Value,5,2)
    Value4 = Value4 * 4   

    Value5 = Mid(Value,7,2)
    Value5 = Value5 * 5 

    Value6 = Mid(Value,9,2)
    Value6 = Value6 * 6

    Value7 = Mid(Value,11,2)
    Value7 = Value7 * 7

    Value8 = Mid(Value,13,2)
    Value8 = Value8 * 8 

    Value9 = Mid(Value,15,2)
    Value9 = Value9 * 9 

    Value10 = Mid(Value,17,2)
    Value10 = Value10 * 10 

    Value11 = Mid(Value,19,2)
    Value11 = Value11 * 11

    Value12 = Mid(Value,21,2)
    Value12 = Value12 * 12

    Value13 = Mid(Value,23,2)
    Value13 = Value13 * 13

    Value = 105 + Value1 + Value2 + Value3 + Value4 + Value5 + Value6 + Value7 + Value8 + Value9 + Value10 + Value11 + Value12 + Value13
     
    Value = Value Mod 103

    0
  • Avatar
    Peter Thane

    What is the full number including the AI please? 

    The AI will also needed to be included in the calculation too I believe, not sure about the leading function1

    Also looking in more detail at the CD calc I think I may have misunderstood the formula and will probably need to revise the above 

    0
  • Avatar
    Lewis Ragonick

    981298730448100327381973

    0
  • Avatar
    Peter Thane

    Sorry it has taken a couple of days but I needed access to a barcode verifier so that I could confirm that my revised VB was correct. I had missed off the function 1 from the earlier script and this messed the whole lot up.

    For GS1-128 barcode number 981298730448100327381973 the Mod 103 check digit is 26.  

    I had given names to both the AI and rest of the code for ease as you can see below:

     

    Value = Format.NamedSubStrings("theAI").Value & Format.NamedSubStrings("codeit").Value

    Value0 = 102 * 1

    Value1 = Left(Value,2)
    Value1 = Value1 * 2

    Value2 = Mid(Value,3,2)
    Value2 = Value2 * 3

    Value3 = Mid(Value,5,2)
    Value3 = Value3 * 4

    Value4 = Mid(Value,7,2)
    Value4 = Value4 * 5

    Value5 = Mid(Value,9,2)
    Value5 = Value5 * 6

    Value6 = Mid(Value,11,2)
    Value6 = Value6 * 7

    Value7 = Mid(Value,13,2)
    Value7 = Value7 * 8

    Value8 = Mid(Value,15,2)
    Value8 = Value8 * 9

    Value9 = Mid(Value,17,2)
    Value9 = Value9 * 10

    Value10 = Mid(Value,19,2)
    Value10 = Value10 * 11

    Value11 = Mid(Value,21,2)
    Value11 = Value11 * 12

    Value12 = Mid(Value,23,2)
    Value12 = Value12 * 13

     

    Value = 105 + Value0 + Value1 + Value2 + Value3 + Value4 + Value5 + Value6 + Value7 + Value8 + Value9 + Value10 + Value11 + Value12 
    Value = Value Mod 103

    0

Vous devez vous connecter pour laisser un commentaire.