Multiply two data sources for one barcode?
Hi there,
I'm having issues with creating a formatting a UPC-A barcode with VB.
The first datasource consists of six numbers.
The next 5 are determined by multiplying one data source (price per lb) with the second data source, net weight.
The last is the check digit.
So far, I have under the barcode data sources:
1. Embedded data: 123456
2. Visual Basic Script:
Value = Format.NamedSubStrings("PricePerLb").Value * Format.NamedSubStrings("NetWtLb").Value
I keep getting this error:
OnAutoSelectedExpression (Line 1): Type mismatch: '[string: ""]'
Is there a better way of going about this? I have also tried transforming the second data source to VB, but the same error comes up.
-
Peter Thane
★ BarTender Hero ★
Depending on when your data is being populated may effect the best way to achieve this, for exampe if it comes from a Database then you will need to make the VB an Event Controlled Script and use the OnNewRecord option or if it is entered on a Data Entry Form you will need to use OnPostPrompt. The code below works although I have set it as a Multiline Routine as I am using fixed fields:
I have used the Transforms tab to control the number of characters in the 2nd substring and pad with leading zeroes where appropriate.
I hope this helps
1 -
Jose Adam Flores Sr.
★ BarTender Hero ★
This an interesting subject to watch for the end result.
UPC-A is probably not the best Barcode to use in this case.
The UPC-a symbology uses Numbers (integer) but Multiplying the weight x price per pound
it's going to yield fractions and somehow it will have to be converted to round numbers and you will have a limit of 5
digits.
mainly the UPC-A barcode it's designed to identify unique products and multiplying the NetWeight x PricePerPound
will not identify a unique product.
you should probably try using a Code-128 or Code-39
in which you will be able to use the calculated values as data source, since those symbologies
support a combination of ASCII characters.
I seem to recall that Seagull Scientific provides Sample formats the can be used with a weight scale
that will allow you to either enter the weight and price to let you print a label like in the Butcher Label.
It might be worth looking into it.
Regards
0 -
Teresa Nguyen
★ BarTender Hero ★
Thank you, this helps a lot!
Would it be possible to add decimal places without the decimal in the UPC-A?
For example 22*1.23 = 27.06
12345602706[CD]
0 -
Peter Thane
★ BarTender Hero ★
Yes, adjust the Character Filter to Numeric only
0
Please sign in to leave a comment.
Comments
4 comments