VB Part Quantity Label Follow


We are using a label with serialization for calculating part qty labels ie order for 100, 30 in a box so we need 4 labels, 3 for 30 and 1 for 10

I have created my Label (not sure how to attach it to this?) with a data entry form to input the qty per box as we dont store this in our DB.

When testing this from within the scripting editor its works flawlessly however it seems than when we actually go to print it seems to break the calculation,

I have included the scripts below including comments on where they are placed;


'3 vbscripts to be put into seperate fields within bartender to calculate part pallet/box labels
'Created By S.Atkins 07/06/2017

'Calculates number of labels needed and rounds up if not a whole number, field called NoOfLabels set as vb event controlled script
'needs to be set against the OnNewRecord event
'this field is then linked to the serial numbers field, done through the forms tab and print dialog
'Relies on the Ceil Function being imported using the script library C:\ProgramData\Seagull\Script Libraries\Ceiling.btvbs
'OnAutoSelectedEvent needs to be set to Value = 1

Value = Ceil((Format.NamedSubStrings("TotalQty").Value/Format.NamedSubStrings("QtyPerBox").Value))

'Supresses Qtyrcv field if there is a lot quantity available
'uses the correct field for calculation if lots are present, field called TotalQty set as embedded data field
'needs to be set against the OnProcessData event, done through the transforms tab

If Field("SxeLive.{.quantity")= "" Then
value = Field("SxeLive.{.qtyrcv")
value = Field("SxeLive.{.quantity")
End If

'Calculates the qty per label and then calculates the qty needed on the last label
'field called QtyOnLabel set as vb event controlled script
'the below needs to be set against the OnSerialize event
'field called LabelCount is just a numeric field set to increment up by 1 for each serial number
'OnAutoSelectedEvent needs to be set to Value = 1

Value1 = Format.NamedSubStrings("LabelCount").Value - 1
Value2 = Format.NamedSubStrings("QtyPerBox").Value * Value1
Value3 = Format.NamedSubStrings("QtyPerBox").Value
Value4 = Format.NamedSubStrings("TotalQty").Value - Value2
Value5 = Format.NamedSubStrings("TotalQty").Value

If (CLng(Value3) > CLng(Value5)) Then
Value = Value5
ElseIf Format.NamedSubStrings("LabelCount").Value = 1 Then
value = Value3
ElseIf CLng(Format.NamedSubStrings("LabelCount").Value) = CLng(Format.NamedSubStrings("NoOfLabels").Value) Then
value = Value4
Else Value = Value3
End IF



I'm pretty to to VB scripting in general let alone within BT so any ideas or thoughts on other ways to achieve this would be a great help.

Thanks in advance



Hayden Edwards
Comment actions Permalink

Could you use the INT function to determine how many full pallets to print and then the MOD function to determine the value (if any) of a part pallet?


Please sign in to leave a comment.