Predefined Aggregate Functions
- 2 minutes to read
When creating a summary item (an ASPxVerticalGridSummaryItem instance), you can define its aggregate function type using the ASPxSummaryItemBase.SummaryType property. ASPxVerticalGrid provides you with built-in implementation of the most popular aggregate functions such as Average, Count, Max, Min and Sum. Summaries of these predefined types are implemented, so that they have a specific summary structure and can be localized and formatted with ease.
Summary Structure
By default, the display text representing a calculated summary consists of the summary label (that describes the applied aggregate function) and the summary display value (that is the calculated value with applied formatting if any).
For each predefined aggregate function type, there is a default summary label representation: when a summary is displayed within the associated row whose values it aggregates (specified by the ASPxSummaryItemBase.FieldName property).
Summary Formatting
ASPxVerticalGrid provides you with flexible summary display text customization means. 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.
Row’s DisplayFormatString
On the row level, you can define a display format for row values (by the EditPropertiesBase.DisplayFormatString property available through a row’s VerticalGridDataRow.PropertiesEdit property), and it will apply to row summary values as well.
Note
The DisplayFormatString property’s setting is not in effect for a summary item if its ASPxSummaryItemBase.ValueDisplayFormat or ASPxSummaryItemBase.DisplayFormat property is specified.
Summary item’s ValueDisplayFormat
On the summary item level, the ASPxSummaryItemBase.ValueDisplayFormat property allows you to additionally format the calculated summary value for display purposes. The summary value pattern, specified by ValueDisplayFormat, can include static text intermixed with a single format item (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.
Summary item’s DisplayFormat
On the summary item level, use the ASPxSummaryItemBase.DisplayFormat property to define a format string specifying the display format for the entire summary. The DisplayFormat property can accept static text intermixed with two format items (indexed placeholder) - {0} and {1}. {0} corresponds to the calculated summary value, and {1} corresponds to the caption of the row, the values of which the current summary aggregates.
Note
If the DisplayFormat property is defined for a summary item, localization using resource strings is not in effect for this summary.
Note that you can also use the ASPxVerticalGrid.SummaryDisplayText event to provide custom display text for summaries.