Using subreports to link web reports together
Subreports are reports that are linked and appear inside another report. Subreports can provide detailed information about a customer beyond the data provided in a parent report, for example:
- If a customer listing provides a customer ID, that customer ID can be input into a subreport that displays details about each customer. An ID value is often the common data between two data sets.
- If a parent report displays only the amount spent (or other customer data), a subreport can provide customer details (such as address). A subreport can show a combined parent report and subreport.
To minimize difficulties that can arise with subreports, test each subreport before building the next subreport. For more information about subreports, see the BIRT Report Designer online help.
To create a subreport
- Design the structure of a report and its subreports.
This structure includes details of required data sets and how they are related. The structure can be a simple relationship diagram of forms. - Create a data source and a required number of data sets.
For an example, consider a parent "People" report that can have an added subreport, which shows roles attached to a particular people record. The relationship structure is:
CTM:People (Person ID) > CTM:SupportGroupFuncRoleLookUp (Person ID)
This structure has two data sets that are required to develop the subreport. - Create the following required data sets:
- A data set for the parent record (CTM:People).
- A data set for the child records (CTM:SupportGroupFuncRoleLookUp).
- On the Parameter tab of data set creation for the child record, create a parameter for the parent key based on which will pull child records.
For example, the key will be Person ID. Do not link the parameter to any report parameter. Click Query and modify the query as follows to pull child records with the same key value as parent record:
"Person ID" = [param:dsPersonID]- Insert a second table element inside the new detail row.
The child table and the child record data set must be associated. - Open the Binding tab of the new child table.
- Bind the key field of the parent data set to the parameter of the child data set parameter.
- Click Data Set Parameter Binding.
- Bind the parent key value to the child.
- Preview the report (save, run, and close the report).
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*