TcxSummaryEventOutArguments.Value Field
Stores the value of the currently processed record.
Declaration
Value: Variant
Field Value
Type | Description |
---|---|
Variant | The value of the currently processed record. |
Remarks
Assign an intermediate result of custom summary calculation to the Value
field within an OnSummary event handler as demonstrated in the following code examples.
Code Examples
Exclude Null Values from Summary Calculation
The following code example excludes all Null Variant record values from summary calculation:
procedure TMyForm.cxGrid1DBTableView1DataControllerSummaryDefaultGroupSummaryItemsSummary(
ASender: TcxDataSummaryItems; Arguments: TcxSummaryEventArguments;
var OutArguments: TcxSummaryEventOutArguments);
begin
if (VarIsNull(OutArguments.Value)) then // If the currently processed value is Null Variant
OutArguments.Done := True; // Ignores the Null Variant record value
end;
Custom Summary Calculation
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;