Skip to main content

TcxDataSummary Class

Represents a set of summaries calculated using grid data.

Declaration

TcxDataSummary = class(
    TcxDataControllerPersistent
)

Remarks

All summaries for a grid control are set via the TcxDataSummary class. There are two main types of summaries you can calculate: footer summaries and group summaries. Footer summaries are calculated for all records using specific items. Footer summaries are displayed in the footer panel at the bottom of the grid.

Group summaries are calculated when data is grouped by an item. Only records within a group are used to evaluate summary values. Group summaries are displayed either in the group panel or in the group footer.

TcxDataSummary provides you with the ability to create several summaries for the same item. This is useful when creating group summaries because they can all be displayed in the group panel, for instance. If you create several footer summaries for one item, only the first footer summary is displayed.

Footer summaries are supported by the FooterSummaryItems property. It identifies a collection of summaries calculated for all grid records by specific grid items.

Group summaries are set via two properties: DefaultGroupSummaryItems and SummaryGroups. The DefaultGroupSummaryItems property determines the default group summaries to calculate when grid records are grouped by any item. SummaryGroups allows you to override the default group summaries for individual grouping items.

Using the SummaryGroups property you define the so called summary groups. Each summary group associates a set of grouping items with group summaries. Every time grid data is grouped by a specific grouping item, the data controller looks for group summaries associated with the item in SummaryGroups. If it fails, it calculates group summaries provided by the DefaultGroupSummaryItems property.

When all summaries have been calculated, the OnAfterSummary event occurs. The TcxDataSummary class enables you to get summary results and change them. Summary results can be obtained via the FooterSummaryValues, GroupSummaryValues and GroupSummaryDisplayValues properties. To return formatted text representations of summary values use the FooterSummaryTexts, GroupSummaryText and GroupFooterSummaryTexts properties.

To calculate summaries only against selected rows or exclude NULL values from summary results use the Options property.

See Also