Subreports¶
Subreports are a feature that allows embeding one report within another. This capability is essential for creating modular and reusable components within your reports. Subreports are completely independent units, equipped with their own parameters, data sources, and dictionaries.
A common application of subreports is to include pages that frequently appear in multiple reports, ensuring consistency and reducing the need to recreate the same content for different reports.
Another significant use case is for content that needs to repeat based on dynamic data. For instance, an Invoice report can be designed as a subreport and then used within a daily sales report to display all invoices for a particular day. This is achieved by repeating the Invoice subreport for each entry fetched by a SQL query that selects invoices from that specific day.
When integrating a subreport into a main report, it is crucial to map the parameters from the parent report to the subreport. This ensures that the subreport functions correctly within the new context, receiving the appropriate data to display accurate and relevant information.
Subreports provide a powerful way to enhance the flexibility and depth of your reporting.
The report editor ribbon's Report tab in CxReports features a command that enables the conversion of subreports to standalone reports and vice versa.