`

aggregates的使用 自动统计wwDBGrid某列的值

 
阅读更多

 

 

 

aggregates的使用

 

1.设置ClientDataSet的属性aggregatesActive为True;接着在aggregates属性上,添加一个aggregates对

象,设置其Expression为:sum(Fee)--自动统计该字段值 并设置Active为true

 

2 取其值:
  if  (CDS2.aggregates[0].Value <> null) then
  begin
     //ShowMessage(FloatToStr(CDS2.aggregates[0].value));
     FMBillGetMoney.cds1.FieldByName('Amount').Value := CDS2.aggregates[0].Value; 
  end;

一般放在ClientDataSet的AfterOpen事件用,那样才能自动统计某列的值;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics