Skip to main content

Predefined Aggregate Functions

  • 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).

ASPxCardView_SummaryStructure

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 Type Description Display in Column Resource String ID Default Format
Average Calculates a column’s average value. Calculated (FieldName) ASPxCardViewStringId.Summary_Average Avg={0}
Max Calculates a column’s maximum value. Calculated (FieldName) ASPxCardViewStringId.Summary_Max Max={0}
Min Calculates a column’s minimum value. Calculated (FieldName) ASPxCardViewStringId.Summary_Min Min={0}
Sum Calculates the sum of a column’s values. Calculated (FieldName) ASPxCardViewStringId.Summary_Sum Sum={0}
Count Calculates the number of records in a column. Any ASPxCardViewStringId.Summary_Count Count={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

    At the column level, you can use the EditPropertiesBase.DisplayFormatString property (available via a column’s CardViewColumn.PropertiesEdit property) to define a display format for column values that also applies to column summary values.

    Note

    The DisplayFormatString property’s setting is not in effect for a summary item if its ASPxSummaryItemBase.ValueDisplayFormat or ASPxSummaryItemBase.DisplayFormat property is specified.

  • A summary item’s ValueDisplayFormat

    At the summary item level, the ASPxSummaryItemBase.ValueDisplayFormat property also allows you to format the calculated summary value for display purposes. The summary value pattern, specified by ValueDisplayFormat, can include static text combined with a single format item (an indexed placeholder) - {0} - that corresponds to the calculated summary value.

    Note

    The ValueDisplayFormat property’s setting is not in effect if the ASPxSummaryItemBase.DisplayFormat property is specified.

  • A summary item’s DisplayFormat

    At the summary item level, use the ASPxSummaryItemBase.DisplayFormat property to define a format string that specifies the display format for the entire summary. The DisplayFormat property can accept static text combined with two format items (indexed placeholders) - {0} and {1}. {0} corresponds to the calculated summary value, and {1} corresponds to the column’s caption - the values of which the current summary aggregates.

    Note

    Localization by resource strings is not in effect in this summary if the DisplayFormat property is defined for a summary item.

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