ActiveReports 18 .NET Edition
Report Authors: Designer Components / Design Reports / Design Page/RDLX Reports / Tutorials: Report Controls in Page/RDLX Reports / Create Hierarchical Lists with List Control
In This Topic
    Create Hierarchical Lists with List Control
    In This Topic

    This article demonstrates the steps to create a simple list and a hierarchical list using the List control in ActiveReports.

    Create Simple List

    Let’s create a report that shows the products information for each category, so the product details will appear corresponding to each category, along with the category name and category description. The report uses 'NWIND.db' data source available on GitHub. It is a SQLite Provider, a custom data provider that works if System.Data.SQLite package is added and referenced in the ActiveReports.config file. See setting up the dependencies and configuration file as described in Configure ActiveReports topic.

    The report uses the List data region with other controls on it so that each control repeats for every record in the dataset. The report also uses a Table to show the details corresponding to each category. The List data region uses detail grouping by the CategoryName grouping value.

    The final report will look like as shown.

    Movie Catalog report created with List data regions

    Create a Report

    In the ActiveReports Designer, create a new RDLX report.

    If you are creating a new report in the Visual Studio Integrated Designer, see Quick Start.

    Bind Report to Data

    As you create a new report, you can configure the report data connection in the Report Wizard. You can also access the Report Data Source dialog by right-clicking the Data Sources node in the Report Explorer and then selecting the Add Data Source option. See SQLite for details.   

    1. On the Choose Data Source Type screen of the wizard, select SQLite and click Next.
    2. To specify the DataBase Path, click the Browse button and navigate to the desired file on your system. For example, you can connect to the Reels.db sample data source which can be downloaded from GitHub.
    3. Click Test Connection to test the connection.
    4. Then click the Next option and configure the dataset by adding a valid query.
      Dataset Query
      Copy Code
      SELECT Movie.Title, Genre.GenreName, Movie.MovieID, Movie.Length, Movie.YearReleased, Movie.UserRating, Movie.MPAA, Movie.Country
      FROM Genre INNER JOIN (Movie INNER JOIN MovieGenres ON Movie.MovieID = MovieGenres.MovieID) ON Genre.GenreID = MovieGenres.GenreID;
      
    5. Into the Name field, enter the name of the dataset as MoviesDataset.    
    6. Click Next to proceed to the final screen of the Report Wizard.
    7. On the final screen of the Report Wizard, review the summary of the report and click Finish to successfully add the report with the SQLite data source.  

    Design Report Layout

    1. Drag and drop the List data region (List1) on the report’s designer.    
    2. With the List selected, click Property dialog to open the List dialog.
    3. In the List dialog, go to Detail Grouping and set the Group on expression =Fields!Title.Value.
    4. Drag and drop the TextBox control onto the List data region and bind it to the [Title] field. This will be the header of each catalog entry for a movie.
    5. Next, drag and drop few TextBox controls below the [Title] textbox on the List2, and set their Value property as follows:
      - TextBox2: Released Year:
      - TextBox3: =Fields!YearReleased.Value
      - TextBox4: Country:
      - TextBox5: =Fields!Country.Value
      - TextBox6: MPAA Rating:
      - TextBox7: =Fields!MPAA.Value
      - TextBox8: Length:
      - TextBox9: ="Length: " & Fields!Length.Value & " min"
      - TextBox10: =Fields!UserRating.Value
    6. To add the report title, drag and drop the TextBox control to the PageHeader section and set its Value property to 'Movies Catalog'.
      Sample Report Layout
    7. Improve the appearance of the report and preview.

    Create Hierarchical List

    You can create reports with hierarchies of expanded lists, using the List control. The report uses 'reels.db' data source available on GitHub. It is a SQLite Provider, a custom data provider that works if System.Data.SQLite package is added and referenced in the ActiveReports.config file. See setting up the dependencies and configuration file as described in Custom Data Provider topic.

    The report displays the movies catalog with the list of movies along with the movies information. The report data is grouped by genre and title of the movies.

    The final report will look like as shown.

    Report with List Control

    Create a Report

    In the ActiveReports Designer, create a new RDLX report. 

    Bind Report to Data

    Connect to a Data Source

    1. As you create a new report, the Report Data Source dialog appears for you to configure the report data connection. You can also access this dialog by right-clicking the Data Sources node in the Report Explorer and then selecting the Add Data Source option.
    2. In the dialog, select the General page and enter the name of the data source, 'ReelsDataSource'.
    3. Under Type, select 'SQLite Provider'. 
    4. In the Connection String, enter the path of the .db, here, 'reels.db', for example
      Connection String
      Copy Code
      Data Source=C:\Data\reels.db
      
    5. Click OK to close the dialog and complete the data source connection.

    Add Dataset

    1. Right-click the added data source and select Add Dataset.
    2. In the Dataset dialog, select the General page and enter the name of the dataset, 'MoviesDataset'.
    3. Go to the Query tab and enter the following query to fetch the required fields:
      Dataset Query
      Copy Code
      SELECT Movie.Title, Genre.GenreName, Movie.MovieID, Movie.Length, Movie.YearReleased, Movie.UserRating, Movie.MPAA, Movie.Country
      FROM Genre INNER JOIN (Movie INNER JOIN MovieGenres ON Movie.MovieID = MovieGenres.MovieID) ON Genre.GenreID = MovieGenres.GenreID;
      

    Design Report Layout

    1. Drag and drop the List data region (List1) on the report’s designer.    
    2. With the List selected, click Property dialog to open the List dialog.
    3. In the List dialog, go to Detail Grouping and set the Group on expression to =Fields!GenreName.Value.
    4. Drag and drop the TextBox control on to the List data region and bind it to the [GenreName] field. This will be the header of the catalog section.
    5. Drag and drop another List data region  (List2) onto the first List.
    6. Click Property dialog to open the List dialog.
    7. In the List dialog, go to Detail Grouping and set the Group on expression =Fields!Title.Value.
    8. Drag and drop the TextBox control onto the List data region and bind it to the [Title] field. This will be the header of each catalog entry for a movie.
    9. Next, drag and drop few TextBox controls below the [Title] textbox on the List2, and set their Value property as follows:
      - TextBox3: Release Year:
      - TextBox4: =Fields!YearReleased.Value
      - TextBox5: Country:
      - TextBox6: =Fields!Country.Value
      - TextBox7: MPAA Rating:
      - TextBox8: =Fields!MPAA.Value
      - TextBox9: Length:
      - TextBox10: =Fields!Length.Value & " min"
      - TextBox11: =Fields!UserRating.Value
    10. To add the report title, drag and drop the TextBox control to the PageHeader section and set its Value property to 'Movies Catalog'.
      Report Structure for List Control
    11. Improve the appearance of the report and preview.
    See Also