You can create a freeform report with groupings in minutes using the Data Dynamics Reports BandedList control.
This walkthrough illustrates how to create a grouped banded list 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
- Adding a BandedList with nested grouping to the report
- Adding report items to the BandedList
- Viewing the report
To complete the walkthrough, you must have access to the Reels sample database included with this installation.
When you are finished you will have a report that looks similar to the following.

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 MovieDetails.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 Movies.
- On the Query page, change the Command Type to TableDirect and enter the "Movie" table into the Query text box.
- Click the Validate icon to validate the table and to populate the Fields list.
- Click the Accept button in the lower right corner to close the smart panel and see Movies and all of the fields in the table appear in the Data Explorer.

Adding a BandedList with Nested Grouping to the Report
To add a BandedList with nested grouping
- From the toolbox, drag a BandedList data region onto the body of the report. The banded list automatically spreads from the left edge to the right edge of the report body and contains a header, detail, and footer band.
- With the banded list selected in the combo box above the property grid, set the DataSetName property to Movies. This makes it easier to add groupings to the list because it populates the Group on Expression box with fields.

Note: To select the banded list, click inside any band in the list and click the four-way arrow that appears at the top left of the control.
- Right-click inside the banded list and select Footer. This removes the footer band which we will not be using, and eliminates white space.
- Right-click inside the banded list and select Insert Group. This adds a group header between the BandedList header and the detail section, and a group footer below the detail section, and opens the Groups smart panel.
- In the Groups smart panel:
- Drop down the list of expressions in the Group on Expression box and select
=Fields!YearReleased.Valueto group the movies based on the year in which they were released.
- Change the Name to Year.
- Clear the Include group footer checkbox since we won't be using it.
- Drop down the list of expressions in the Group on Expression box and select
- Click the Add icon. This adds a second group header above the first, and a group footer below the detail section.
- Still in the Groups smart panel:
- Select the newly added group in the list of groups.
- Drop down the list of expressions in the Group on Expression box and select
=Fields!MPAA.Valueto group the movies based on the rating (i.e. G, PG, et cetera).
- Change the Name to MPAA.
- Clear the Include group footer checkbox since we won't be using it.
- Click the Accept button in the lower right corner to close the smart panel and accept the changes.

Adding Report Items to the BandedList
To add report items to the BandedList
- From the toolbox, drag a TextBox report item onto the topmost band (BandedList1_Header).
- Set the BackgroundColor property to Gray.
- Set the Color property to White.
- Expand the Font property and set its sub-properties to:
- FontSize 14pt
- FontWeight Bold
- Set the Location property to 0in, 0in.
- Set the Size property to 6.5in, 0.25in.
- Set the TextAlign property to Center.
- Set the Value property to Movie Details to create a static label.
- Click the BandedList1_Header band adorner (the grey bar along the top of the band) to select it, and in the property grid, change the RepeatOnNewPage property to True. This ensures that the label appears at the top of each page.
- Set the Height property of the header band to 0.25in.
- If the Data Explorer is not in view, from the View menu, select Other Windows, then Data Dynamics Reports Data Explorer (at the bottom).
- From the Data Explorer, drag the YearReleased field into the second band (Year_Header) of the banded list.
- Set the BackgroundColor property to DarkGray.
- Expand the Font property and set its sub-property FontWeight to Bold.
- Set the Location property to 0in, 0in.
- Set the Size property to 6.5in, 0.25in.
- Set the TextAlign property to Left.
- Change the Value property expression from the Sum aggregate to the First aggregate to display the first year released for each group. (A summary of the YearReleased field would not be very useful.)
- Click the Year_Header band adorner (the grey bar along the top of the band) to select it, and in the property grid, set the Height property of the header band to 0.25in.
- Drag the MPAA field into the third band (MPAA_Header).
- Set the BackgroundColor property to Silver.
- Set the BorderColor property to Gray and the BorderStyle property to Solid.
- Expand the Font property and set its sub-property FontWeight to Bold.
- Set the Location property to 0in, 0in.
- Set the Size property to 6.5in, 0.25in.
- Note that the Value property is automatically set to an expression using the First aggregate. This displays the movie rating for each group.
- Click the MPAA_Header band adorner (the grey bar along the top of the band) to select it, and in the property grid, set the Height property of the header band to 0.25in.
- Click inside the detail band to select it and set its Height property to 1.2in.
- Drag the following six fields onto the detail band and set their properties as indicated.
Field Location Size Formatting Title 0in, 0.25in 3.75in, 0.25in Country 1.25in, 0.5in 1in, 0.25in Language 1.25in, 0.75in 1in, 0.25in Length 5.375in, 0in 1in, 0.25in TextAlign = Left UserRating 5.375in, 0.5in 1in, 0.25in TextAlign = Left IsColor 5.375in, 0.75in 1in, 0.25in - Once you've arranged the fields, select the IsColor field and change the Value property to the following expression so that instead of "True" or "False," it will read "Color" or "Black and White."
=Iif(Fields!IsColor.Value=True, "Color", "Black and White")
- Drag six TextBox report items onto the detail band and set their properties as indicated.
Value Location Size Formatting Movie Title: 0in, 0in 1in, 0.25in FontWeight = Bold Country of origin: 0in, 0.5in 1.25in, 0.25in FontWeight = Bold Language: 0in, 0.75in 1in, 0.25in FontWeight = Bold Length: 4.25in, 0in 1in, 0.25in FontWeight = Bold; TextAlign = Right User Rating: 4.25in, 0.5in 1in, 0.25in FontWeight = Bold; TextAlign = Right Format: 4.25in, 0.75in 1in, 0.25in FontWeight = Bold; TextAlign = Right - Draw a Line report item onto the detail band below all of the text boxes.
- Set the LineColor property to Gray.
- Set the LineWidth property to 3pt.
- Set the Location property to 0in, 1.12in.
- Set the EndPoint property to 6.5in, 1.12in.
- 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 & "..\\..\\MovieDetails.rdlx") Me.ReportPreview1.OpenReport(rpt)
//C# System.IO.FileInfo rpt = new System.IO.FileInfo(Application.StartupPath + @"..\..\..\MovieDetails.rdlx"); this.reportPreview1.OpenReport(rpt);
- Run the project.
Reference
Banded List