count barcode objects that have value
Hi,
So I have a template with 64 barcodes that are linked to different text input boxes.
Sometimes not all of them are used. Can I use VB script to count how many have value and put the value on the template? My problems:
How to access them from the script? ReferenceField("Barcode 1") doesn't give an error so it seems it can access the object but it always returns empty.
Where to run the script? OnPrintJobStart is too early.
-
I would suggest making your calculation field a VB Scripe>Event Controlled Script set to run OnPostPrompt.
There probably is an easier way to do it, and perhaps if you know a VB programmer they can help, but if not you probably need to do something like this:
Value = 0
If Format.Objects("Barcode 1").Value = "" then
Value = Value
else Value = Value + 1
end ifIf Format.Objects("Barcode 2").Value = "" then
Value = Value
else Value = Value + 1
end ifIf Format.Objects("Barcode 3").Value = "" then
Value = Value
else Value = Value + 1
end ifIf Format.Objects("Barcode 4").Value = "" then
Value = Value
else Value = Value + 1
end ifIf Format.Objects("Barcode 5").Value = "" then
Value = Value
else Value = Value + 1
end ifetc....
finishing with
Value = Value
You can link to the Format.Objects("Barcode 1").Value from the Template Objects in the Script Assistant on the right.
For my label with 5 barcodes, 2 of which are empty then the VB value is 3 as per the below
1 -
Thank you Peter,
I don't see OnPostPrompt
0 -
You are trying to apply it as a Document Level Script and not adjusting the label field itself and making that a VB Script>Event Controlled Script>OnPostPrompt field
1 -
Yes, that's it. This seems to work. Thank you.
I'm self learning Bartender and still unaware of some possibilities.
0
Please sign in to leave a comment.
Comments
4 comments