Now we will see another powerful tool in Crystal Reports; that is subreport. Subreport is used to create a report inside another report and link the two reports with a relation or a filter.
Create TableAdapter, which contains the employee orders and all the data in the table
Orders
. We will rename the adapter toOrdersByEmployeeIdTableAdapter
as we see in the following screenshot:In the main report, in the Details section, right-click and navigate to Insert | Subreport. Drag-and-drop this subreport at the end of the main report (after the
Notes
field in the Employee Details section). Then we will see the following screenshot:As we see, we can choose the subreport from the application reports, export it from hard disk, or create a new report using Report Wizard. We will choose the last option, so click on the Report Wizard... button and complete the wizard as we have learned before. Make sure that you use the
OrdersByEmployeeId
table as a data source for the subreport...