Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxSummaryEventArguments.RecordIndex Field

Stores the index of the currently processed record.

#Declaration

Delphi
RecordIndex: Integer

#Field Value

Type Description
Integer

The index of the currently processed record.

#Remarks

You can use the RecordIndex field to identify the source record in the parent data controller.

#Code Example: 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;
See Also