Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

12.07 Linked with a Data Field

Linked with a Data Field

Linking subreports with a data field lets you use a data field in the main report to filter the data in the subreport. The two fields must be of the same data type to link them together. If this is a PC database, then both fields must have an index already set up in the database.

To create a linked subreport, select the data field from the listbox on the left and add it to the listbox on the right. Once the data field is added, the linking frame at the bottom appears and shows you the parameter field name and the field in the subreport’s data field to link to. The parameter name is automatically filled in for you. This parameter is used internally to pass the main report’s field value to the subreport. Normally, when you have a parameter field on a report, the user is prompted to enter a value for the parameter before the report can be run. This is not the case with subreports. Subreports populate the parameter with the value of the field from the main report behind the scenes. You do not have to worry about this implementation.

The checkbox on the right tells the subreport that the main report’s data field is being linked to a field in the subreport. This will be checked by default. Below the checkbox is a dropdown box listing the fields in the subreport. Select the one that is used to filter the data in the subreport. It must be of the same data type as the field from the main report.