How subreport linking works – HP Intelligent Management Center Standard Software Platform User Manual

Page 642

Advertising
background image

When you are considering whether to use a subreport or linked tables, you
need to understand the ramifications of each. These issues are discussed
fully in

Performance considerations in one-to-many links

.

As a general rule, if you have indexed tables, linked indexed fields, or range
limiting record selection criteria based on the indexed fields, the program
needs to read the same number of records whether you are linking tables in
a single report or using subreports. Since each subreport is run as a separate
report, linked tables may have a performance advantage. See

Indexed tables

.

How subreport linking works

When you link a subreport to a primary report, the program creates the link
by using a parameter field.

When a subreport link field is selected, the program creates:

A parameter field in the subreport which is then used to retrieve values
passed to it by the primary report.

A record selection formula for the subreport using the parameter field.

The selection formula limits the subreport to those records in which the
link field is equal to the parameter field value.

When the report is run, the program finds the first primary field record it needs
and passes the value in the link field to the parameter field in the subreport.
The program then creates the subreport with record selection based on the
parameter field value. Here is an example:

You create a report that shows customer data and a subreport that shows
order data and then you link the two reports using the Customer ID field.

When you run the report, the program finds the first customer record it
needs and passes the Customer ID value from that record to the subreport
parameter field.

The program runs the Orders subreport. Since the subreport selection
formula selects only those records in which the Customer ID value is
equal to the parameter field value, and since that parameter field value
is equal to the Customer ID in the first record in the primary report, the
subreport contains only those records that have the same customer ID.
Namely, those records that are orders for the first customer.

642

Crystal Reports 2008 SP3 User's Guide

Subreports

24

What are subreports?

Advertising