VBScript Transform Working on Sample Data, but not when Printing
Hello,
I'm new to BarTender and VBScript, this is my second day using it.
I'm looking to use a VBScript Transform to parse data. My data source type is 'Embedded Data' and it is linked to a user text input on a Data Entry Form.
The user will enter the Quantity, and if it contains the letter Q in the first spot, the Q will be removed.
My code is as follows (with help from these forums!):
Value = Format.NamedSubStrings("Quantity").Value
Value1 = Len(Value)
Value2 = Value1-1
Value3 = Left(Value,1)
If Value3 = "Q" then
Value = Right(Value,Value2)
end if
Value = Value
This works as desired on the Sample Data. If I enter Q1000 in the sample data, the output in the VB test script is 1000.
However, when I try to print and have the user enter the value themselves in the Data Entry Form, the Quantity Field is blank.
Have I made an error in reassigning the parsed data to the Quantity variable after transforming it?
Thanks in advance.
-
Peter Thane
★ BarTender Hero ★
You may need to make this an Event Controlled Script and OnPostPrompt so that the VB is applied after the data has been entered on the the data entry form.
(Note I also renamed the field QTY from quantity as I believe that may be referenced elsewhere in part of the main printing process and so you could have a naming conflict.)
The top field on the image below is the value from the Data Entry whilst the middle field holds the VB script routine.
The bottom field is an Object Value type field linked to the text field connected to the Data Entry box, but has had a character filter applied to it to make it numeric only so that the Q would be ignored anyway.
1 -
L K
★ BarTender Hero ★
Changing from Embedded Data to an Event Controlled VBScript worked perfectly, thank you Peter.
0
Please sign in to leave a comment.
Comments
2 comments