Linking Techniques
To determine whether your subreports are going to be linked or unlinked, you first need to understand the different techniques available for linking reports together. That enables you to make an intelligent choice about which type of subreport to use. Even though unlinked reports aren’t officially related to each other, there are still ways that they can pass information to each other as well.
Table 9-1 is a summary of the different linking options between a main report and a subreport. This is for linked as well as unlinked subreports. A more thorough description of each of these options and related examples are listed in the following sections.
Table 9-1. Subreport linking options
Linking Option | Description |
---|---|
Linked with a data field | A field from the main report is passed to the subreport and this is used for filtering records. If the field is from a PC database (e.g. MS Access), then it must be indexed. |
Linked with a formula field | A formula’s value from the main report is passed to the subreport and this is used to filter records. This is a way to trick Crystal Reports into linking with non-indexed fields in PC databases (e.g. MS Access, Excel). |
Unlinked | The subreport is not connected to the main report. There is no data passed between the main report and the subreport. The subreport uses a data source that is independent of the parent report. This is used for combining unrelated reports into a single report. |
Unlinked using a formula field | A formula’s value from the main report is passed to the subreport, but it doesn’t affect record selection. It can be used for displaying non-critical data on the subreport. |
Unlinked using global variables | Multiple variables are used to pass data back and forth between the parent report and the subreport. This lets the parent report keep track of what the subreport is printing or possibly display subreport totals. |