Back to Devexpress

Predefined Aggregate Functions

aspnet-119612-components-card-view-concepts-data-shaping-and-manipulation-data-summaries-predefined-aggregate-functions.md

latest2.8 KB
Original Source

Predefined Aggregate Functions

  • Dec 17, 2020
  • 3 minutes to read

When you create a summary item (an ASPxCardViewSummaryItem instance), you can use the ASPxSummaryItemBase.SummaryType property to define its aggregate function type. ASPxCardView provides a built-in implementation of the most popular aggregate functions such as Average, Count, Max, Min, and Sum. The summaries of these predefined types are implemented so that they have a specific structure, and they can be localized and formatted with ease.

Summary Structure

The display text of a calculated summary consists of the summary label (which describes the applied aggregate function) and the summary display value (which is the calculated value with applied formatting, if any).

Summary Text Localization

The table below describes the predefined function types, and lists the corresponding resource strings (and their default format patterns) used for localization.

Summary TypeDescriptionDisplay in ColumnResource String IDDefault Format
AverageCalculates a column’s average value.Calculated ( FieldName )ASPxCardViewStringId.Summary_AverageAvg={0}
MaxCalculates a column’s maximum value.Calculated ( FieldName )ASPxCardViewStringId.Summary_MaxMax={0}
MinCalculates a column’s minimum value.Calculated ( FieldName )ASPxCardViewStringId.Summary_MinMin={0}
SumCalculates the sum of a column’s values.Calculated ( FieldName )ASPxCardViewStringId.Summary_SumSum={0}
CountCalculates the number of records in a column.AnyASPxCardViewStringId.Summary_CountCount={0}

The {0} placeholder in format patterns contains the calculated summary value.

Note that the resource strings listed in this table are used to localize summary label text, but not summary display values. You can utilize these resource strings when you localize your application through global resources, as described in the following help topic: Localizing ASP.NET Controls via Global Resources (Obsolete from 11.2).

Summary Formatting

ASPxCardView allows you to customize summary display text. You can use the following properties to provide a custom format for the summary value, or even the entire summary text displayed by a summary item:

  • A column’s DisplayFormatString

  • A summary item’s ValueDisplayFormat

  • A summary item’s DisplayFormat

Note that you can also use the ASPxCardView.SummaryDisplayText event to provide custom display text for summaries.