Considering Subreport Execution Time and Performance

There are two types of Subreports In-Place and On-Demand. Both of the sample reports have been what are called In-Place Subreports. An In-Place Subreport is one that is virtually indistinguishable from the main report components when viewed because it is run at the same time as the main report. In-Place Subreports are displayed as components of the main report like any other report object and require no special business user interaction to view them. On-Demand Subreports, on the contrary, are not executed at the same time as the main report and require user interaction to be viewed.

All In-Place Subreports on a main report are run at the execution time of the main report. In the two examples presented in this hour, this has clearly not caused any performance problems, but as you might imagine, it could on larger databases. Imagine running the last sample report (with the Product Suppliers Subreport in every Group Header) for a large conglomerate with thousands of products. The Product Suppliers Subreport would need to run thousands of times to complete the presentation of the main report. Moreover, the thousands of supplier Subreports would be unlikely to be used by any given business user and would therefore have run extraneously. An elegant solution to that problem is the use of On-Demand Subreports.

Unlike In-Place Subreports, On-Demand Subreports only execute when a user requests them. They lie dormant until that time. The performance benefits to On-Demand reports are clear; however, it does come at the expense of a less seamless integration than In-Place Subreports and a small delay in viewing because the Subreport executes dynamically after being requested.

Taking the last example, follow these quick steps to make the Product Suppliers Subreport an On-Demand Subreport:

  1. Open the most recent sample report if you have closed it.

  2. Right-click on the Product Suppliers Subreport and select the Format Subreport option. Many familiar formatting options will be available here (see Figure 16.6), but click immediately on the Subreport tab.

    Figure 16.6. Format Subreport dialog.

    graphics/16fig06.jpg

  3. Click the On-Demand Subreport check box to turn on that option. You will notice that the On-Demand Caption section will become un-grayed.

  4. Click on the On-Demand Caption button (x-2) and type 'Supplier List' (include the apostrophes) in the Text Editing area. Click on the Save and Close button, and you should now have a main report that resembles Figure 16.7.

    Figure 16.7. Sample Report with Linked and On-Demand Suppliers Subreport.

    graphics/16fig07.jpg

graphics/lightbulb_icon.gif

Careful consideration should be given to report design when deciding between In-Place and On-Demand Subreports. There is a trade-off between the seamless integration of In-Place Subreports and the performance benefits of On-Demand Subreports that must be considered in addition, of course, to the specific requirements of the business users' overall experience.




Sams Teach Yourself Crystal Reports 9 in 24 Hours
Sams Teach Yourself Crystal Reports 9 in 24 Hours
ISBN: B003D7JUVW
EAN: N/A
Year: 2005
Pages: 230

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net