FireDac动态创建汇总字段(Aggregated Fields)


 var
   oField: TAggregateField;
   i: Integer;
...
FDQuery1.FieldDefs.Updated := False;
FDQuery1.FieldDefs.Update;
for i := 0 to FDQuery1.FieldDefs.Count - 1 do
   FDQuery1.FieldDefs[i].CreateField(Self);

oField := TAggregateField.Create(FDQuery1);
oField.FieldName := 'Total';
oField.Expression := 'SUM((ItemPrice + ItemTaxes) * ItemCount)';
oField.DataSet := FDQuery1;

FDQuery1.AggregatesActive := True;
FDQuery1.Open;


联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678