Understanding Subreports


A subreport is a report within a report. Figure 13-1 displays a graphical representation of the structure of a subreport within a primary report.

click to expand
Figure 13-1: Graphical representation of a report that uses a subreport

Subreports have most of the characteristics of a regular report: They contain their own database tables and fields separate from the main report, they contain their own report design area where you may define the appearance of the report, and they contain their own selection criteria.

Generally, the only real differences between a subreport and a primary report are the following:

  • A subreport may be placed within any report section. The entire subreport will then print in that section.

  • A subreport may be inserted as an object into the primary report. A subreport may not stand on its own.

  • A subreport may not contain another subreport.

  • A subreport does not have a Page Header or a Page Footer section.

In Crystal Reports, there are two types of subreports — unlinked and linked. These are summarized in the following two sections. We explore both types of subreports within this chapter.

The Unlinked Subreport

Unlinked subreports do not attempt to coordinate their data with the primary report. In other words, an unlinked subreport does not match up records to the records within a primary report. Unlinked subreports do not need to use the same data as the primary report — in fact, an unlinked subreport often does not even share the same data source as the primary report.

The Linked Subreport

Linked subreports, in comparison to unlinked subreports, do share the same data source as a primary report. A linked subreport's data is linked and coordinated with the primary report's data. In other words, both reports contain records that are matched up.

As an example, say that your primary report contains employee information and your subreport contains order information (where this order information is linked to the employee information). For each employee record, a linked subreport would include all orders for that employee only. You can try your hand at creating a linked subreport later in this chapter.




Mastering Business Analysis with Crystal Reports 9
Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)
ISBN: 1556222939
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Chris Tull

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