Calculate a Summary

This tutorial describes the steps required to calculate one of the built-in summary functions in your report.

Note

This approach to calculating summaries applies when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Bindings.

See Calculate a Summary to learn about the alternative approach to calculating summaries.

See Data Binding Modes to learn more about the available binding modes.

The report created in this topic displays the total number of ordered units:

How to -  CalculateSummary2

Do the following to calculate a summary function in your report:

  1. Start with a report that is bound to the sample Northwind database's "Products" table (the nwind.mdb file included in the XtraReports installation). See Provide Data to Reports to learn more about binding a report to a data source. This tutorial starts with the following report layout:

    How to - CalculateSummary

  2. Add the Report Footer band to display a summary at the bottom of the report.

    Shared_BandsAddReportFooter

  3. Drop the UnitsOnOrder field from the Field List onto the created band.
  4. Click the label's smart tag, and in its actions list, set the Summary Running property (XRSummary.Running) to Report to calculate the summary for the entire report.

    Set the Summary Func (XRSummary.Func) to Sum. In addition to a simple summary, you can choose among numerous built-in functions (see the Expression Constants, Operators, and Functions topic to learn more).

    You can also define a format string (XRControl.TextFormatString).

    How to -  CalculateSummary1

    Enable the XRSummary.IgnoreNullValues option in the Property Grid if a data source contains such records and they should not affect the sum.

    calculate-summary-ignore-null-values