Add One To A Named Label Object Value (Hyphenated Numbers) In Vbscript
My label has 2 named barcode objects reading the same database field. The field value will be a hyphenated number such as 10-20-1.
I need one of the objects to add one to this value before printing such as 10-20-2. the serialization transform on the 2nd object doesnt seem to work. Is there a way in vbscript to accomplish this?
-
I am replying to my own post. I finally got it working and maybe it would be useful to someone....
The customer provided thousands of sequenced item#'s all in one column of an excel file:
[attachment=1658:excel_Sample.png]
The printed label had to look similar to:
[attachment=1659:label_output.png]
When Bartender connects to this database it treats each cell as a separate record and Bartender doesn't allow printing multiple records on one label. As a workaround only the first barcode will read the first record of each group/label from the excel file such as; 01-01-1, 01-02-1 etc. The other barcodes will get their data by referencing the first barcode and manipulate this data to look like the sample above. the first barcode object is assigned a name (number) and called by the other barcodes using VbScript:
value=format.namedsubstrings("number")
Each barcode must increment the original value but can't until the hyphens are removed first using VbScript:
value=replace(value,"-","")+1
Note the serialization transform can't be used because it only works after printing a label and I need it to be updated before printing.
The next challenge was when the value was incremented, for some reason, Bartender would remove the leading zero. I used the transforms to pad the zero and re-insert the hyphens.
If anyone has successfully used VbScript to re-insert hyphens (or any character) and pad characters plse reply............
0 -
Seems like you could take your first row value of each quartet and do Left(string,Len(string)-1) - this would give you: 0x-0y-
Then your print value would be something like this: Left(string,Len(string)-1) plus - your incrementing 1, 2, 3, 4 transformed to a string with CSTr(incrementing counter)
Hope this helps.
Regards,
jr
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare