FireDAC.Comp.DataSet.TFDAggregate

From RAD Studio API Documentation
Jump to: navigation, search

System.Classes.TCollectionItemSystem.Classes.TPersistentSystem.TObjectTFDAggregate

Delphi

TFDAggregate = class(TCollectionItem)

C++

class PASCALIMPLEMENTATION TFDAggregate : public System::Classes::TCollectionItem

Properties

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

Description

TFDAggregate represents a maintained client aggregated value in a FireDAC dataset.

Use TFDAggregate to create and maintain a calculated client aggregated value.

TFDAggregate are collected into the TFDAggregates collection. The set of TFDAggregate may be created at design time as well as at run time.

The Expression property specifies the formula. GroupingLevel defines the set of records on which the value will be calculated. The value is calculated if Active and AggregatesActive are set to True.

If you want to display the aggregated value using data-aware controls, use TAggregateField instead of TFDAggregate.


Example

ADQuery1.AggregatesActive := True;
ADQuery1.Open;

with ADQuery1.Aggregates.Add do begin
  Name := 'AvgSalary';
  Expression := 'Avg(Salary)';
  Active := True;

  if InUse then
    Label1.Caption := VarToStr(Value)
  else
    Label1.Caption := '<not accessible>';
end;

See Also