FireDAC.Comp.DataSet.TFDDataSet.AggregatesActive

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property AggregatesActive: Boolean read FAggregatesActive write SetAggregatesActive default False;

C++

__property bool AggregatesActive = {read=FAggregatesActive, write=SetAggregatesActive, default=0};

Properties

Type Visibility Source Unit Parent
property public
FireDAC.Comp.DataSet.pas
FireDAC.Comp.DataSet.hpp
FireDAC.Comp.DataSet TFDDataSet

Description

Controls the automatic calculation of aggregate values.

Use AggregatesActive to get or set the flag that controls the automatic maintenance and calculation of the dataset aggregate values. 

When AggregatesActive is False (the default), the dataset does not maintain aggregates. This allows the dataset to perform large updates to the dataset or fetch big volumes of data without the overhead of calculating aggregate values, which happens at fetching or data editing. When AggregatesActive is True, the dataset calculates and maintains all the aggregate values specified by the Aggregates property that are compatible with the current index. 

To selectively enable and disable aggregates rather than turning them all on or off at once, use the Active property of individual TFDAggregate objects. These objects are available through the Aggregates property. 

If the application needs to perform batch updates to the dataset, then set AggregatesActive to False before updating, and return to the original value after updating. Also, see the BeginBatch and EndBatch methods.

Example

var
  lPrevAggsActive: Boolean;
...
lPrevAggsActive := FDQuery1.AggregatesActive;
FDQuery1.AggregatesActive := False;
try
  // perform updates here, without calculating and reading client aggregates
finally
  FDQuery1.AggregatesActive := lPrevAggsActive;
end;

See Also