A script handler you can implement to override standard MoneyWorks behaviour.
Automatically called: Immediately before running a report (but after the report settings dialog has been OK'd).
Use for: You can use this opportunity to tweak the report (in particular, you can use SetReportColumnWidth to modify tab stops in the report to hide or show columns. You can also abort generation of the report by returning FALSE from this handler.
Return value: Boolean: return FALSE to cancel the report.
Example: The built-in Details report in Standard Plugins/Reports/~Transaction/ uses a SetupReport handler to configure the columns of the report according to the user's selection of Debits & Credits, Net, Tax, Gross or Items & Qty:
on SetupReport let dc = Val("Debits_and_Credits") let iq = Val("Items_and_Qty") SetReportColumnWidth("COL7", 190) if dc SetReportColumnWidth("COLPRICE", 0) SetReportColumnWidth("COLUNIT", 0) elseif not iq SetReportColumnWidth("COLPRICE", 80) SetReportColumnWidth("COLUNIT", 0) else SetReportColumnWidth("COLPRICE", 80) SetReportColumnWidth("COLUNIT", 30) endif end
Note: Although report custom controls are automatically instantiated as variables for the report, note that when a report script control is compiled, the custom controls are not yet available, but they will be available when the script runs, hence the use of
Val(control_name) to get the values of the radio button controls.
Specific Naming: None, but this handler will generally only be implemented in a script control that is local to the report.