ActiveReports 13
Create a Summary Report
ActiveReports 13 > ActiveReports User Guide > How To > Section Report How To > Create Common Section Reports > Create a Summary Report

In a section layout, 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.

These steps assume that you have already added a Section Report template in a Visual Studio project and connected it to a data source. See Adding an ActiveReport to a Project and Bind Reports to a Data Source for further information.

Note: These steps use the Products table from the NWind database. The sample NWind.mdb database file is located in the [User Documents folder]\GrapeCity Samples\ActiveReports 13\Data folder.

To calculate and display subtotals in a report

  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. Go to the Preview tab to view the report and see the Sub Total appear below each group of data similar to the following image.



To calculate and display grand total in a report

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. Go to the Preview tab to view the report and see the Grand Total appear on the last page of the report.



See Also