You can create a master detail report using the Data Dynamics Reports Table control and grouping.
This walkthrough illustrates how to create a simple tabular report.
The walkthrough is split up into the following activities:
- Creating a Data Dynamics Report
- Connecting the report to a data source
- Adding a dataset to the report
- Adding controls to the report to contain data
- Viewing the report
To complete the walkthrough, you must have access to the Reels sample database.
Creating a Data Dynamics Report
To create a report in Visual Studio
- Create a new project in Visual Studio.
- From the Visual Studio Project menu, select Add New Item.
- In the Categories pane, select Data Dynamics Reports.
- In the Templates pane, select Report and name the report CustomerOrders.rdlx.
- Click Add in Visual Studio 2005.
Connecting the report to a data source
To connect the report to a data source
- If the Data Explorer is not in view, from the View menu, select Other Windows, then Data Dynamics Reports Data Explorer (at the bottom).
- Click the Add icon and select the Data Source... option.
- In the Report DataSource smart panel that appears, select the General page.
- Change the Name to Reels.
- Select the Shared Reference checkbox.

- Click the Browse button and select ReelsDataSource.rdsx, which is located in C:\My Documents\Data Dynamics\Reports\build number\Samples\Reels.

Note: In Windows Vista, the path is C:\User\your name\Documents\Data Dynamics\Reports\build number\Samples\Reels\. - Click the Accept button in the lower right corner to close the smart panel and see Reels appear in the Data Explorer.

Adding a dataset
To add a dataset
- Click the Add icon and select the Data Set... option.
- In the DataSet smart panel that appears, select the General page.
- Change the Name to CustomerOrders.
- On the Query page, paste the following SQL command into the Query text box:
SELECT CustomerID, Title, LastName, Quantity, Price, [Quantity]*[Price] AS Total FROM CustomerOrders WHERE CustomerID < 1010;
- Click the Validate icon to validate the query and to populate the Fields list.
- Click the Accept button in the lower right corner to close the smart panel and see CustomerOrders and the selected fields appear in the Data Explorer.

Adding controls to contain data
To add a Table control with grouping to the report
- From the toolbox, drag a Table data region onto the body of the report.
- With the table selected in the property grid, set the DataSetName property to CustomerOrders.
- Click inside the table to display the column and row handles along the top and left sides of the table.
- To visually group the data within the report, right-click the icon to the left of the detail row and select Insert Group.
- In the Table Data Region - Groups smart panel that appears, under Expression select
=Fields!CustomerID.Value
This groups all details from each customer. - Change the Name to Customer.

Note: You cannot change the name of a table group until after you have set the expression. - Click the Accept button in the lower right corner to close the smart panel and see the group header and footer rows added to the table.

To add a fourth column to the table
- Select the second column and change its Width property to 0.92in.
- Select the third column and change its Width property to 1.04in.
- Select the first column and change its Width property to 3.5in.

Tip: Making some columns narrower before making other columns wider prevents your report width from changing. - Right-click the grey table header above the third column and select Insert Column to the Right. The inserted fourth column has the same width as the third column, 1.04in.
To add data to the table
- Hover your mouse over the Textbox located in the first column of the group header row of the table to make the Field Selector Adorner appear. Click this to open the Field Selector context menu and select the LastName field from the list of available fields. This automatically places an expression in the group header row and simultaneously places a static label in the table header row. Set the font size of this Text Box to 12pt.
- Delete the static label Last Name from the table header row.
- To display static labels at the beginning of each new group, right-click the icon to the left of the group header row and select Insert Row Below.
- Using the Field Selector Adorner in the first column of the detail row, select the Title field. Type Title into the text box immediately above it.
- Delete the static label Title from the table header row.
- Use the Field Selector Adorner to select the Quantity field for the second column of the detail row of the table. This automatically places an expression in the detail row and simultaneously places a static label in the header row of the same column.
- Cut the static label and paste it into the inserted row immediately above the detail row.
- Select the Price field for the third column of the detail row of the table and set its Format property to C for currency.
- Cut the static label from the group header and paste it into the inserted row immediately above the detail row.
- Select the Total field for the fourth column of the detail row of the table and set its Format property to C for currency.
- Cut the static label from the group header and paste it into the inserted row immediately above the detail row.
To refine the look of the report
- To remove the table header row since it is not being used:
- Right-click in the row headers to the left of the table.
- Select Table Header. The table header row is removed.
- To display the static labels in bold at the top of every page of the report on which the table renders:
- Select the Header row containing the labels by clicking in the table handle to the left of the row.
- In the Report Formatting tool bar, click the Bold button.
- In the Property grid, set the RepeatOnNewPage property to True.
- Select the Header row containing the labels by clicking in the table handle to the left of the row.
- To add subtotaling to the group, drag the Total field into the group footer row in the fourth column. Notice that the expression automatically uses the Sum function.
- Set the Format property to C for currency.
- In the Report Formatting tool bar, click the Bold button.
- To add grand totaling to the table, drag the Total field into the table footer row in the fourth column.
- Set the Format property to C for currency.
- In the Report Formatting tool bar, click the Bold button.
- Delete the static label Total from the top row.
- To add a page header to the report, open the Report menu and select Page Header.
- From the toolbox, select TextBox and draw it onto the PageHeader section to span the entire width of the report.
- Set the alignment to center and the font size to 14pt.
- Enter Customer Orders for the value.
- From the File menu, select Save.
Viewing the report
Any report designed with Data Dynamics Reports can be opened in the included Data Dynamics Reports Viewer application or you can view it at design time.
To view the report at design time
- Click the Preview tab of the report designer.
To view the report at run time
- Add the ReportPreview control to your Visual Studio toolbox and drop it onto your Windows form.
- Set the Dock property of ReportPreview1 to Fill so that it will automatically resize if the form is resized at run time.
- Double-click the viewer to go to the Load event and use code like the following.
'Visual Basic.NET Dim rpt As New System.IO.FileInfo(Application.StartupPath & "..\\..\\CustomerOrders.rdlx") Me.ReportPreview1.OpenReport(rpt)
//C# System.IO.FileInfo rpt = new System.IO.FileInfo(Application.StartupPath + @"..\..\..\CustomerOrders.rdlx"); this.reportPreview1.OpenReport(rpt);
- Run the project.