TcxSummaryEventArguments Record
Stores input arguments of summary calculation events.
Declaration
TcxSummaryEventArguments = record
Remarks
A summary item uses one of the predefined calculation algorithms to iterate through all target record values of the associated data item. Every iteration of the summary calculation process raises a summary calculation event that allows you to modify the calculation algorithm for individual target values.
TcxSummaryEventArguments
and TcxSummaryEventOutArguments records are accessible within a summary calculation event handler through Arguments
and OutArguments
parameters. These records allow you to identify the currently processed summary item, record, its value as well as modify the active summary calculation algorithm based on this information.
Main API Members
The list below outlines key members of the TcxSummaryEventArguments
record. These records allow you to identify the currently processed summary item and the source dataset record.
- RecordIndex
- Returns the index of the source dataset record. You can use this index to identify the source record in the parent data controller.
- SummaryItem
- Provides access to the currently calculated summary item.
Code Example
All predefined summary calculation algorithms use record values of only one data item. The OnSummary event allows you to modify a predefined summary calculation algorithm in any manner. For example, you can use values of multiple data items in every iteration of the summary calculation process.
The code example below demonstrates an OnSummary event handler that modifies the predefined algorithm MAX. The event handler calculates the highest population density based on data-aware grid columns that display country areas (DBTableView1Area) and corresponding population values (DBTableView1Population):
procedure TMyForm.cxGrid1DBTableView1DataControllerSummaryDefaultGroupSummaryItemsSummary(
ASender: TcxDataSummaryItems; Arguments: TcxSummaryEventArguments;
var OutArguments: TcxSummaryEventOutArguments);
var
AArea, APopulation: Variant;
begin
// Obtain the area value for the currently processed record
AArea := ASender.DataController.Values[Arguments.RecordIndex, DBTableView1Area.Index];
// Obtain the population value for the currently processed record
APopulation := ASender.DataController.Values[Arguments.RecordIndex, DBTableView1Population.Index];
OutArguments.Value := APopulation/AArea; // Calculates the custom summary value (maximum population density)
end;
Direct TcxSummaryEventArguments Type Reference
The Arguments
parameter of the TcxSummaryEvent procedural type references the TcxSummaryEventArguments
record.