Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Collapse]Card View
   [Expand]Product Information
   [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
     [Expand]Sorting
    [Expand]Data Formatting
     Appearance Customization
     Adaptivity
     Save and Restore Layout
    [Expand]Templates
     Export Overview
     Toolbars
   [Expand]Visual Elements
   [Expand]Member Tables
   [Expand]Examples
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [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]Document Server
[Expand]Reporting
[Expand]Report 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 summary provides five predefined aggregate functions. These functions allow you to calculate:

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

ASPxCardView 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 card involved in summary calculation. To enable you to perform any initialization and finalization, the event is raised before and after the processing of cards.

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 card in a card view. The SummaryProcess property is set to CustomSummaryProcess.Calculate. At this stage you should accumulate summaries.

    The event parameter's properties allow the processed card 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 during the Initialization or Finalization, set the event parameter's TotalValueReady property to true at the Initialization stage. This automatically skips the Calculation stage and Finalization starts immediately.

Expanded Example

This example shows how to implement a custom summary calculation.

Note that in order to process selection changes on the server side, you can either set the ASPxGridBehaviorSettings.ProcessSelectionChangedOnServer property to true or handle the ASPxClientCardView.SelectionChanged client event and call the ASPxClientCardView.PerformCallback client method.

How would you rate this topic?​​​​​​​