Optimize Report


The Optimize Report menu option, available in the Report Editor and defaults to 'enabled'. Optimize Report has no effect on flat Table based reports, but in the case of set based reports, it will prune any tables from the set that are not referenced by the report.


As an example, if you created a Report on the invoice set and referenced fields only from the 'Invoice_header' table and 'Customer' Table, then 'Optimize Report' would detatch the Invoice_Items table, and the Product and Vendor table below that before it printed the Report. Though most of times, this behaviour is desired because it speeds the printing of Set based Reports considerably, It can sometimes cause problems, so it can be disabled easily by unchecking the option. An example of a condition where this is not desired is when you externally filter your Report on child tables which are never included in the content. If you had a Report called 'MyReport' based on the invoice set which did not reference any of the customer fields, and the Report was optimized, then executing the following code would fail.

report.preview("MyReport","customer->firstname = 'John'")

The reason that this would fail is because the Report has optimized 'customer' out, so even though we know that the invoice set includes 'Customer' invoice, the 'MyReport' invoice Report has removed Customer because the report never references that table.