Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

9.03 Types of Subreports

Types of Subreports

There are two types of subreports available: Unlinked and Linked. The type defines the relationship between the report and the subreport as well as whether their data sources are related to each other.

Unlinked subreports have no relationship to the main report. The data sources used on each report are completely unrelated to each other. As each data source is printed, its contents have no effect on how the other data source is printed. In the chapter introduction, an invoice was given as an example of an unlinked subreport. An invoice prints billable items for a client during the month. The invoice header lists the address and contact information for the company (or its local division). The table containing the corporate address is in no way related to the table containing the client’s sales data, but the report has to pull information from each table to print the invoice. To create this invoice, you would build a normal report showing the sales detail in the body of the report and in the page header you would add an unlinked subreport which prints the corporate contact information.

Linked subreports have a direct relationship with the main report. Data from the main report is passed to the subreport and this is used to filter what the subreport prints. For example, you could use a linked subreport in an invoice. In the page footer, you can add a linked subreport which shows any credits issued to the customer during that time period. The subreport shows the correct credit charges because it filters the data using the Client ID field from the main report.