ActiveReports 18 .NET Edition
Report Authors: Designer Components / Design Reports / Design Section Reports / Tutorials: Section Report Scenarios / Create a Summary Report
In This Topic
    Create a Summary Report
    In This Topic

    In a section report, you can display totals and subtotals by modifying the summary fields of a TextBox control. Use the following steps to learn how to add totals and subtotals in a report.

    Note: These steps use the Products table from the NWind database. The NWIND.db file can be downloaded from GitHub.

    Create a Report

    In the ActiveReports Designer, create a new Section report. 

    Bind Report to Data

    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 clicking the DataSource Icon in the Detail section band.
    2. Choose Custom tab > SQLite Provider in the Report Data Source dialog, and bind the report to Sqlite data using the following connection string and query.
      Connection String
      Copy Code
      data source=c:\data\NWIND.db
      
       
      DataSet Query
      Copy Code
      Select * from Products  ORDER BY CategoryID
      
         
    3.    Click OK to close the Report Data Source dialog and return to the report design surface. 

    Design Report Layout

    Calculate and display subtotals in a report
    Design summary report layout

    1. Right-click the design surface and select Insert, then Group Header/Footer to add group header and group footer sections to the layout.
    2. With the GroupHeader section selected in the Properties Window, set its DataField property to CategoryID. This groups the data on the report according to the set field.
    3. From the Report Explorer, drag and drop the following fields onto the corresponding sections of the report.
      • Field Name = CategoryID
        Section = GroupHeader

      • Field Name = ProductName
        Section = Detail

      • Field Name = UnitsInStock
        Section = Detail

      • Field Name = UnitsInStock
        Section = GroupFooter

    4. With the UnitsInStock field in the GroupFooter selected, go to the Properties Window and set the following:
      • SummaryFunc: Sum
      • SummaryType: Sub Total
      • SummaryRunning: Group
      • SummaryGroup: GroupHeader1
    5. Preview the report and see the Sub Total appear below each group of data similar to the following image.
         

    Calculate and display the grand total in a report
    Summary section report with totals and subtotals

    These steps are a continuation of the procedure above. The report generated at the end of this procedure contains totals and subtotals.

    1. Right-click the design surface and select Insert, then Report Header/Footer to add report header and footer sections to the layout.
    2. From Report Explorer, drag and drop the UnitsInStock field onto the ReportFooter section go to the Properties Window and set the following:
      • SummaryFunc: Sum
      • SummaryType: GrandTotal
      • SummaryRunning: All
    3. Preview the report and see the Grand Total appear on the last page of the report.