Operation Manual
Understanding Databases
Linking tables
25
Crystal Reports User’s Guide 495
Subreports and data files
If your primary report is based on Table A, the subreport is based on Table B,
and the records are linked, your primary considerations are as follows:
• The number of subreports that are run by the program is determined by
the index and the selection formula situation in the primary report:
• If Table A is indexed, and if the primary report has a selection formula
that passes down range limit conditions for the indexed field, the
program runs two subreports.
• If Table A is not indexed, or if Table A is indexed but the selection
formula does not pass down range limit conditions for the indexed
field, the program runs 26 subreports.
• The number of records read for each subreport is determined by the
index situation on Table B:
• If you have an index on Table B, the program will read only the
matching records (100) when it runs a subreport.
• If you do not have an index on Table B, the program will always read
every record in Table B (2600) when it runs a subreport.
SQL database considerations
Since indexes are not critical with SQL data, the primary concern with both
linked tables and subreports is whether or not there is a selection formula in
the primary report that puts range limits on Table A. See “Linking data files” on
page 493.
Linked SQL tables
If there are range limit conditions in the selection formula, the program passes
those conditions down to the server.
• If there is a selection formula that puts range limits on Table A, the server
locates the records in Table A that satisfy the selection criteria (2),
matches them up with the appropriate records in Table B (100), and
returns 200 merged records to the Report Engine.
• If there is no selection formula, or if there is a selection formula that does
not put range limits on Table A, the server matches up each record in
Table A (26) with the appropriate records in Table B (100), and returns
2600 merged records to the Report Engine.
In either case, the Report Engine will then apply the entire selection formula
to the merged records.