I have a simple set where I have customer data with a one to many link to their service invoices. When I print a report based on the customer information it prints multiple copies. We have figured out that it is printing as many copies as there are child links. For example if there are 4 invoices attached to that customer it is printing the report 4 times (actually 12 as we are telling it to print 3 copies to begin with).
How do I correct this? Here is the xbasic script being used:
How do I correct this? Here is the xbasic script being used:
Code:
record_number = current_record_number() query.filter = "recno() = " + record_number query.order = "" 'This script will override certain of the printer properties that are specified in the saved layout. delete options dim options as p 'before you can initialize 'options' using the property_from_string() function at least one dot variable must exist. therefore, create a dummy variable. options.dummy = 1 options_text = <<%str% <papersize="Letter"> <copies=3> %str% 'create a dot variable from options_text. the dot variable contains the printer properties to be overriden property_from_string(options,options_text) 'now you can delete the dummy variable delete option.dummy 'oldOptions will store the current printer options, so that we can restore them. delete oldOptions dim oldOptions as p oldOptions.dummy = 1 'set the printer override settings. if API_GETMACHINENAME() = "Spaservice" old_printer_name = report.Printer_override(""+chr(92)+chr(92)+"POOLSERVICE\Service Order Printer on Ne00:",options,oldOptions) end if if API_GETMACHINENAME() = "Poolservice" old_printer_name = report.Printer_override("Service Order Printer on Ne00:",options,oldOptions) end if 'delete the dummy variable delete oldOptions.dummy :Report.Print("pool_cont1",query.filter,query.order) 'Now restore the original printer settings report.printer_override(old_printer_name,oldOptions)
Comment