AnyDAC
ContentsIndexHome
PreviousUpNext
TADQuery.AggregatesActive Property

Controls automatic calculation of aggregate values.

Group
Links

Use AggregatesActive to get / set the flag controlling automatic maintenance and calculation of 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 overhead of calculating aggregate values, which happens at fetching or data editing. When AggregatesActive is True, the dataset calculates and maintains all 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 TADAggregate objects. These objects are available through the Aggregates property. 

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

property AggregatesActive: Boolean;

Calculated and Aggregated Fields,Aggregates, TADAggregate.Active, BeginBatch, EndBatch

var
  lPrevAggsActive: Boolean;
...
lPrevAggsActive := ADQuery1.AggregatesActive;
ADQuery1.AggregatesActive := False;
try
  // perform updates here, without calculating and reading client aggregates
finally
  ADQuery1.AggregatesActive := lPrevAggsActive;
end;
What do you think about this topic? Send feedback!