[]
        
(Showing Draft Content)

Subreport

The Subreport control is a placeholder for data from a separate report. Subreports make sense when you need to nest groups of data from different data sources within a single data region, or when you can reuse a subreport in a number of reports.

Some properties of the Subreport control are described below. Note that you need to enable Advanced Properties Mode to view all properties.

Common

Report Name: The parent report name.

Data

Data Set Name: Select a dataset to associate with the banded list. The drop-down list is populated with all of the datasets in the report's dataset collection.

Data Set Parameters: Add data set parameters to filter the data to display in reports at preview.

Merge Transactions: Indicates if transactions in the parent report and subreport are merged.

Border

Width: Enter a value in points to set the width of the border.

Style: Select a style for the border.

Color: Select a color to use for the border from Color Picker, Standard Colors, or Web Colors.

Layout

Keep Together: Indicates if the data inside the subreport is kept together on a single page if possible.

No Data

Message: The message to display in the data region when no rows of data are available.

Color: Select a color to use for the message from Color Picker, Standard Colors, or Web Colors.

Font Style: Apply a font style on the message. Note that if you chose a theme for Layout > Style, the text appears according to the selected theme. You can select the following styles:

   Normal - Makes text appear in normal style.

   Italic - Makes text appear italicized.

Text Decoration: Lets you decorate the text by use of lines. You can choose from:

   Underline - Draws a line below the text.

   Overline - Draws a line above the text.

   LineThrough - Draws a line through the middle of the text.

Format: Select one of the common numeric formats, provided in the list.

MISC

Inherit Style Sheet: Indicates if the stylesheet from the parent report is used in the subreport.

Substitute Theme On Subreport: Indicates if the theme from the parent report is used in the subreport.

Use Case

We want to create a master report that uses the Subreport control for displaying the data from another report, the details report. The master report will display Employees with the basic information - Name, Title, City, and Country, along with the list of orders, fetched from the details report.

The master report uses the List data region that will contain TextBox controls to display the data. The List data region repeats any report control it contains for every record in the dataset. The master report uses a parameter that is passed from the master report to the detail report to filter the details.

The final report will be as shown.

Create Details Report

  1. Create an RDL report and drag-drop the Table control onto the design area.

  2. From the dataset, drag the following data fields to the Details row of the Table control: [OrderId], [OrderDate], [ShippedDate], [RequiredDate], [ShipVia], and [Freight]. The Header row above the details row is automatically filled with labels.

  3. In the footer row of the table, in the extreme right cell, enter the following expression =Sum(Fields!Freight.Value). Your table should now look as shown.

  4. To add a report parameter, go to the Data tab and click Add next to the 'Parameters'. A parameter, Parameter1, is added.

  5. Click Parameter1 to edit the parameter properties.

  6. Set the Data Type property to Integer.

  7. Enable the Hidden property for the parameter to True.

  8. Select the Table control and go to the Properties pane.

  9. In the Filters property, go to Show Items, and select Add Item.

  10. Click the icon to display the filter properties.

  11. Click the radio button next to the Filter Expression and select 'EmployeeId'.

  12. From the drop-down next to Operator, select 'Equal'.

  13. Click the radio button next to Value and enter the expression =Parameters!Parameter1.Value.

Create a Master Report

  1. Drag-drop the List data region onto the design area of the report.

  2. Drag-drop three TextBox controls onto the List data region.

  3. Drag-drop the Subreport control onto the List region.

  4. From the Properties pane of the Subreport control, set the Report Name property to the detail report's name.

  5. To use the Details report parameter, from the Properties pane of the Subreport control, go to the Report Parameters property.

  6. Click Show Items and then select Add Item.

  7. Click the Filter Property Icon to view the parameter properties and set the Name property to 'Parameter1'.

  8. In the Value field, enter the following expression =Fields!EmployeeId.Value.

  9. Select TextBox1 and enter the expression ="Name: " & Fields!LastName.Value & ", " & Fields!FirstName.Value.

  10. Select TextBox2 and enter the expression = "Title: " & Fields!Title.Value.

  11. Select TextBox3 and enter the expression =Fields!City.Value & ", " & Fields!Country.Value.

  12. To add the report title, drag-drop a TextBox control above the List data region.

  13. Click inside the text box and enter the text 'Employee Orders Report (Master-Detail Report)'.

  14. Improve the appearance of the report by resizing the controls and applying font style and alignment properties.

  15. Preview the report.