[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Scheduler
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Gauges
  [Collapse]Vertical Grid
   [Expand]Product Information
   [Expand]ASPxVerticalGrid Getting Started
   [Expand]Fundamentals
   [Collapse]Concepts
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Expand]Data Editing
    [Collapse]Data Shaping and Manipulation
     [Collapse]Data Summaries
       Total Summary
       Predefined Aggregate Functions
       Obtain Summary Values
       Custom Aggregate Functions
     [Expand]Filtering
      Sorting
    [Expand]Data Formatting
     Appearance Customization
     Templates
    [Expand]Export
     Toolbars
    ASPxVerticalGrid Designer
   [Expand]Visual Elements
   [Expand]Member Tables
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Custom Aggregate Functions

Total summaries provide five predefined aggregate functions. These functions allow you to calculate:

  • the number of records
  • the maximum and minimum values
  • the sum and the average value

ASPxVerticalGrid provides the ASPxGridBase.CustomSummaryCalculate event that enables you to implement custom aggregate functions or calculate summary values using a custom algorithm. Custom summaries allow you to:

  • calculate summaries against records that meet specific criteria
  • involve multiple data fields in calculations
  • implement complex summary functions (e.g., the standard deviation of a population), etc.

Expanded General Information

To calculate a summary manually:

The ASPxGridBase.CustomSummaryCalculate event fires for each record involved in summary calculation; when calculating a total summary value, the event is raised for each record; to enable you to perform any initialization and finalization, the event is raised before and after the processing of records

The summary calculation consists of three stages.

  • Initialization

    The CustomSummaryCalculate event is raised once and the SummaryProcess property is set to CustomSummaryProcess.Start. At this stage, you can initialize summary values (e.g., reset internal counters).

  • Calculation

    The CustomSummaryCalculate event fires multiple times, once for each record in a grid. The SummaryProcess property is set to CustomSummaryProcess.Calculate. At this stage you should accumulate summaries.

    The event parameter properties allow the processed record and its values to be obtained.

  • Finalization

    The CustomSummaryCalculate event is raised once and the SummaryProcess property is set to CustomSummaryProcess.Finalize. At this point, calculate a final summary value and assign it to the event parameter's TotalValue property.

To determine the current stage, use the event parameter's SummaryProcess property.

To skip the Calculation stage and calculate a custom summary at the Initialization or Finalization stage, set the event parameter's TotalValueReady property to true at the Initialization stage. This automatically skips the Calculation stage and the Finalization stage starts immediately.

Is this topic helpful?​​​​​​​