Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aggregating a calculated field in TClientDataset

Is it possible to add an aggregate field over a calculated field?

Suppose there is a cds with following fields:

  • ID(autoincrement)
  • Name(string)
  • Price(float)
  • Quantity(integer)
  • Total(integer) - calculated field - Price * Quantity

and I want to add an agregate to get the sum of Total column. Is it possible?

like image 461
DreadAngel Avatar asked May 08 '12 11:05

DreadAngel


1 Answers

Yes, that is possible if you change the calculated field to an InternalCalc field. The calculation is still done in the OnCalcFields event, but you have to check the state for InternalCalc when you make the calculation for that field.

like image 143
Uwe Raabe Avatar answered Oct 05 '22 23:10

Uwe Raabe