How to set a dynamic print quantity using a database field and a data entry form value?
Question
Each record has a quantity, but I want to set an additional copies per each record in a data entry form. How do you set a dynamic print quantity using a database field and a data entry form value?
Answer
This can be done with some scripting, as there is no direct means to do this.
1. Create an off-label object that will house the value.
2. Link your text box or other form element that will take the kit quantity to this text box.
3. Go to File > Print then click the properties button next to the quantity
4. Change the options to "Get Quantity from data source"
5. Select the data source option and change the type to a VB Script
6. Build the expression.
Field("TestDB.TestTable.Qty") + Int(Format.Objects("Text 9").Value)
What I've done here is grab a field from my database (in my case, it's labeled Qty) and then add it to the object value of the off-label object (Text 9). You can use the Script Assistant to help build this function with the Template Objects and the Database fields. Your function will look different than mine but the general idea is going to be the same.
You want to keep the Int( ) in the script else the script considers it a text and just concatenates the text itself. So 12 + 1 would become 121. That's just too many.
More Information
The function here adds extra to the print quantity. The + operator can be changed to pretty much any operator to modify the print quantity with the script.