0

I work on a project contain 2 ClientDataSet the first ClientDataSet1 contain a field with type DataSet set to ClientDataSet2
I want show sum of field (Value) in ClientDataSet2 in field (Sum) in ClientDataSet1
Now I use aggregate to get the sum but I can't show it in ClientDataSet1
I had search and read for 2 days but I can't get it to work This is a simple application show what I need

Delphi Lover
  • 85
  • 1
  • 11
  • 1
    If I understood it correctly you are trying to use `nested datasets` to achieve what you want. AFAIK you can't do that directly. Anyway, check [Cary Jensen's article](http://edn.embarcadero.com/article/29825). You might find its information useful. – Guillem Vicens Dec 01 '15 at 07:40
  • @GuillemVicens Yes its nested, it looks great article, this will help me understand many things, Thank you. – Delphi Lover Dec 01 '15 at 10:07

1 Answers1

0

I found out how to do it

procedure TForm1.ClientDataSet2AfterPost(DataSet: TDataSet);
begin
  if ClientDataSet2Sum.Value <> null then
  ClientDataSet1Sum.Value := ClientDataSet2Sum.Value;
end;
Delphi Lover
  • 85
  • 1
  • 11