Skip to main content

Search

Search

Adding Object Value To Custom Check Digit

Comments

4 comments

  • Avatar
    Ian Cummings
    Moderator

    It looks like you named the object with this value rather than the data source.  You need to name the data source.  An event based VB script might also be needed to calculate the check digit at the correct time in the print process.  Also, the full way to reference a data source value is like with the below expression:

     

    Format.NamedSubStrings("VariableExpirationDate").Value

    0
  • Avatar
    Legacy Poster

    Ian, 

    Thank you for the prompt response. 

    I named the data source and used the aforementioned expression as suggested.

    The Object value in the barcode is the expiration date without the "-" symbol. (Expiration date is 2025-12-10)

     

    So in this case, the object value was 20251210 and I expected the Check digit to be "D" (2+0+2+5+1+2+1+0 = 13) but instead I got "%" who's value is 42 !! 
    (I believe that the reason is because the expression takes the "-" into account and hence 2+0+2+5 + 36 +1+2+ 36 +1 + 0 = 85. Therefore, 85/43 yields a reminder of 42 ! )

    So do you have any suggestions on how to incorporate the expiration date without the "-" symbol in the VB SCRIPT?


    Thanks!


    [attachment=2012:Incorrect Check Digit.btw]

    0
  • Avatar
    Ian Cummings
    Moderator

    Change the code to the below which removes the hyphens.

     

    C39Mod43(Replace(Format.NamedSubStrings("VariableExpDate").Value, "-", ""))
    
    0
  • Avatar
    Legacy Poster

    Ian, 

    Thank you once again for the quick reply!
    It's working fine now. 






     

    0

Please sign in to leave a comment.