tags:

views:

597

answers:

2

I need to create an Aggregate Field in a TClientDataSet, but as said in the docs:

Choose OK. The newly defined aggregate field is automatically added to the client dataset and its Aggregates property is automatically updated to include the appropriate aggregate specification.

When I add a new aggregate field, the aggregate specification isn't added to the TClientDataSet's Aggregates, therefore I can't use its OnUpdateMethod.

I also tried handling the OnChange event of my new Aggregate Field, but it isn't fired at all.

Am I doing something wrong? I just want to have an aggregated field and fire an event everything it's value change.

Is this broken on delphi? Because what is in the documentation doesn't reflect the actual behavior.

edit: @Michal Sznajder I'm using Delphi 2007

+1  A: 

Which version of Delphi ? I just tried clean D7 application and TAggregateField was added.

Michal Sznajder
+1  A: 

I think you may be getting confused between TAggregate and TAggregateField objects, and the Delphi documentation probably isn't helping.

AFAICT, TAggregateField objects are automatically 'recalculated' and can be bound to data-aware controls like TDBText, but don't have any OnUpdate event.

"TAggregate" objects, on the other hand, do have an OnUpdate event, but can't be bound to data-aware controls.

This may be enlightening: http://dn.codegear.com/article/29272

Roddy