ActiveReports 13
Banded List Reports
ActiveReports 13 > ActiveReports User Guide > Samples and Walkthroughs > Walkthroughs > Page Report/RDL Report Walkthroughs > Layout > Banded List Reports

You can create a freeform report with groups using the Banded List control. This walkthrough illustrates how to create a grouped BandedList report.

The walkthrough is split up into the following activities:

Note:

When you complete this walkthrough you get a layout that looks similar to the following at design time and at run time.

Design-Time Layout

Run-Time Layout

To add an ActiveReport to the Visual Studio project

  1. Create a new Visual Studio project.
  2. From the Project menu, select Add New Item.
  3. In the Add New Item dialog that appears, select ActiveReports 13 Page Report and in the Name field, rename the file as rptBandedList.
  4. Click the Add button to open a new fixed page report in the designer.

See Adding an ActiveReport to a Project for information on adding different report layouts.

To connect the report to a data source

  1. In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
  2. In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like ReportData.
  3. On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.

To add a dataset

  1. In the Report Explorer, right-click the data source node and select the Add Data Set option.
  2. In the DataSet Dialog that appears, select the General page and enter the name of the dataset as Movies. This name appears as a child node to the data source icon in the Report Explorer.
  3. On the Query page of this dialog, change the Command Type to TableDirect and enter Movie into the Query text box.
  4. Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.

  5. Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.

To add the BandedList with grouping

  1. From the toolbox, drag a BandedList data region onto the design surface and go to the properties window to set the DataSetName property to Movies.
    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.
  2. Right-click inside the banded list and select Footer. This removes the footer band that we are not using in this walkthrough.
  3. 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 BandedList - Groups dialog.
  4. In the BandedList - Groups dialog, drop down the list of expressions in the Group on expression box and select =Fields!YearReleased.Value to group the movies based on the year in which they were released.
  5. In the same dialog, change the Name to Year.
  6. In the same dialog under Layout, clear the Include group footer checkbox to remove the group footer.
  7. Click the Add icon. This adds a second group header under the first, and a group footer below the detail section.
  8. In the same dialog, select the newly added group from the list of groups, drop down the list of expressions in the Group on expression box and select =Fields!MPAA.Value to group the movies based on the rating (for example, G, PG, etc).
  9. In the same dialog, change the Name to MPAA.
  10. In the same dialog under Layout, clear the Include group footer checkbox to remove the group footer.
  11. Click OK to close the dialog.

To add controls to the BandedList

  1. From the toolbox, drag a TextBox control onto the top-most band (BandedList1_Header) and in the Properties window, set the following properties:
    Property Name Property Value
    BackgroundColor Gray
    Color White
    FontSize 14pt
    FontWeight Bold
    Location 0in, 0in
    Size 6.5in, 0.25in
    TextAlign Center
    Value Movie Details
  2. Click the BandedList1_Header band adorner (the grey bar along the top of the band) to select the banded list header.
  3. In the Properties window, set the following properties for the banded list header:
    Property Name Property Value
    RepeatOnNewPage True
    Height 0.25in
  4. From the Report Explorer drag the YearReleased field onto the first grouping band (Year_Header) of the banded list.
  5. With this field selected, go to the Properties window to set the following properties:
    Property Name Property Value
    BackgroundColor DarkGray
    FontWeight Bold
    Location 0in, 0in
    Size 6.5in, 0.25in
    TextAlign Left
    Value =First(Fields!YearReleased.Value)
  6. Click the Year_Header band adorner (the grey bar along the top of the band) to select it and go to the properties window to set the Height property of the header band to 0.25in.
  7. From the Report Explorer, drag the MPAA field into the second grouping band (MPAA_Header) of the banded list.
  8. Go to the Properties window to set the following properties:
    Property Name Property Value
    BackgroundColor Silver
    BorderColor Gray
    BorderStyle Solid
    FontWeight Bold
    Location 0in, 0in
    Size 6.5in, 0.25in
    Note: The Value property is automatically set to an expression using the First aggregate. This displays the movie rating for each group.
  9. Click the MPAA_Header band adorner (the grey bar along the top of the band) to select it and go to the properties window to set the Height property of the header band to 0.25in.
  10. Click inside the detail band to select it and in the properties window, set its Height property to 1.2in.
  11. From the Report Explorer, drag the following six fields onto the detail band and in the properties window, set their properties as indicated.
    Data Field Property Name
    Title Location: 0in, 0.25in
    Size: 3.75in, 0.25in
    Country Location: 1.25in, 0.5in
    Size: 1in, 0.25in
    Language Location: 1.25in, 0.75in
    Size: 1in, 0.25in
    Length Location: 5.375in, 0in
    Size: 1in, 0.25in
    TextAlign = Left
    UserRating Location: 5.375in, 0.5in
    Size: 1in, 0.25in
    TextAlign = Left
    IsColor Location: 5.375in, 0.75in
    Size: 1in, 0.25in
    Note: When you drag and drop fields from a dataset in the Report Explorer onto the design surface, these fields are automatically converted to Textbox controls that you can modify by setting the control properties in the Properties Window.
  12. Once you've arranged the fields, select the IsColor field and in the properties window, 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")
  13. From the toolbox, drag six TextBox controls onto the detail band and in the properties window, set their properties as indicated.

    TextBox1

    Property Name Property Value
    Value Movie Title:
    Location 0in, 0in
    Size 1in, 0.25in
    FontWeight Bold

    TextBox2

    Property Name Property Value
    Value Country of origin:
    Location 0in, 0.5in
    Size 1.25in, 0.25in
    FontWeight Bold

    TextBox3

    Property Name Property Value
    Value Language:
    Location 0in, 0.75in
    Size 1in, 0.25in
    FontWeight Bold

    TextBox4

    Property Name Property Value
    Value Length:
    Location 4.25in, 0in
    Size 1in, 0.25in
    FontWeight Bold
    TextAlign Right

    TextBox5

    Property Name Property Value
    Value User Rating:
    Location 4.25in, 0.5in
    Size 1in, 0.25in
    FontWeight Bold
    TextAlign Right

    TextBox6

    Property Name Property Value
    Value Format:
    Location 4.25in, 0.75in
    Size 1in, 0.25in
    FontWeight Bold
    TextAlign Right
  14. From the toolbox, drag a Line control onto the detail band and in the Properties window, set the properties.
    Property Name Property Value
    LineColor Gray
    LineWidth 3pt
    Location 0in, 1.12in
    EndPoint 6.5in, 1.12in
  15. For a Page report, in the Report Explorer select the BandedList control and in the Properties window, set its FixedSize property to 6.5in, 7in.

To view the report

OR

See Also