Skip to main content

Merge Reports: Use Data-Driven Page Sequence

  • 3 minutes to read

This topic describes how to combine a table report that uses the Portrait page orientation and a chart report that uses the Landscape page orientation. A sample combined report is available in the Report Merging demo.

xtrareports-merge-reports

Follow the steps below to create a combined report:

Create a Chart Report

  1. Create a chart report that shows all products in a category. The report is bound to thesample Northwind database‘s Products table. Set the report’s Landscape property to true to enable the Landscape page orientation.

    xtrareports-subreport

  2. Add the CatID parameter to your chart report to specify which product category to build the chart for. Right-click Parameters in the Field List (Visual Studio Report Designer) and choose Add Parameter.

    xtrareports-subreport-add-parameter

  3. Select the created parameter and set its Parameter.Name property to CatID, Parameter.Type to Int32 and Parameter.Visible to false.

    xtrareports-subreport-configure-parameter

  4. Click the report’s smart tag. Click the XtraReportBase.FilterString property’s ellipsis button. In the invoked FilterString Editor, construct an expression to compare the CategoryID data field to the CatID parameter. To access the parameter, click the icon on the right until it turns into a question mark.

    xtrareports-subreport-add-parameter

  5. Rebuild your solution.

    xtrareports-add-subreport

Create the Base Report

  1. Join the Northwind database’s Products and Categories tables in the Query Builder. Create a report bound to the resulting query, and arrange a layout like the one shown below:

    xtrareports-create-report

  2. Right-click the base report’s Detail band and select the Insert Band / Group Footer item in the context menu.

    toolbox-drop-report-control-label

  3. Drag an XRSubreport item from the Toolbox onto the added group footer band.

    xtrareports-add-subreport

  4. Click the subreport control’s smart tag. In the Sub-Report Tasks window, set the Report Source parameter to the chart report’s location.

    xtrareports-add-subreport

  5. Enable the GenerateOwnPages option to print the embedded report on separate pages and use its own page settings.

    xtrareports-subreport-enable-generateownpages

  6. Bind the chart report’s CatID parameter to the base report’s CategoryID data field. Click the subreport’s smart tag and select Edit Parameter Bindings in the invoked SubReport Tasks window.

    xtrareports-add-subreport

  7. The Parameter Bindings Collection Editor is invoked. Click Add to add a new binding. In the binding properties list, specify the data field to bind to and the parameter name to bind.

    xtrareports-add-subreport

  8. Switch to Preview mode to see the combined report.

    xtrareports-merge-reports

Your base report’s Table of Contents and Document Map include bookmarks from the embedded report. Use the XRSubreport.BookmarkParent property to specify the nesting level for the embedded report’s bookmarks.

See Also