String Padding Values In Vbscript
Hello I have a simple question.
I have several prompts on my label some of the fields must be padded when printed in a 2D barcode, but when displayed in human readable, the padded zeros must not be there.
I can get the label to where all the inputs are combined into a single 2D code with a long sub-string list.
But what is the code to pad these strings either PadRight with blank spaces for characters or PadLeft with 0's for numeric values so that they will appear only when the 2D is scanned.
I think it's a simple line of code but I'm unfamiliar with VB and the help didn't have anything about padding when I searched.
-
Michael Toupin (mtoupin
★ BarTender Hero ★
To validate and pad leading zeroes, you'll want to use a VB script like this:
If len(value) < 8 thenDo Until len(value) = 8value = "0" & valueLoopEnd if0 -
Legacy Poster
★ BarTender Hero ★
I had to change it to multi-line script but I was able to get it working properly.The attached shows the final code in case it might help others.
FYI I did have several of these sub-strings to update and I found that the Bartender program frequently crashed during the process on the Script Assistant window. I had to exit and reopen the file, re-do the changes with the same exact code and it let me save. These crashes happened quite often. I think there might be a few bugs with the Script Assistant part of BarTender. Anyhow I was able to go through it carefully and slowly and I was able to produce the label I needed.
Thank you for your assistance.
0 -
Moinabegum Biradar
★ BarTender Hero ★
Hello I have a simple question.
I have Quantity field on my label, this field must be left padded with zeros when printed in a 2D barcode, but when displayed in human readable, the padded zeros must not be there for Quantity.
Please suggest how to satisfy the above requirement in BarTender template.0 -
Peter Thane
★ BarTender Hero ★
The simplest way would be to make the field to be padded an Object Value field and then connect that to the none padded field. After that use the Transforms>Number of Characters to add your padding
0
Iniciar sesión para dejar un comentario.
Comentarios
4 comentarios