Adding Object Value To Custom Check Digit Follow

0
Avatar
Legacy Poster

Hello, 

I created a custom check digit for my barcode using C39Mod43 function and tried to add an object value to this script. The Object Value of the Expiration date was named as "VariableExpirationDate" and it was in YYYYMMDD format.

I keep getting an error saying that the variable is undefined but I can't find a solution on how to define/add the object value to the VB Script. Please find the attached bartender file for reference. I'd be glad if someone can help me on this. Thanks! 

[attachment=2003:Script error.btw]

4 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

Change the code to the below which removes the hyphens.

 

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

Ian, 

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






 

Please sign in to leave a comment.