tags:

views:

84

answers:

1

hi, I have created a dynamic TClientDataSet component and tried to fire the OnCalcFields event....it has'nt worked. The code looks like this...

 table := TClientDataset.Create(Application);
  table.OnCalcFields := tableCalcFields; //where 'tablecalcfields' is the method defined by me.
  table.FieldDefs := Query1.FieldDefs;
  table.CreateDataSet;
  table.Open;
  Query1.First;
  while not Query1.Eof do
  begin
    table.Append;
    for I := 0 to Query1.FieldList.Count - 1 do
    begin
      table.FieldValues[table.FieldList[i].DisplayName] :=
                  Query1.FieldValues[Query1.FieldList[i].DisplayName];
    end;
    Query1.next;
    table.Post;
  end;
  DataSource2.DataSet := table;
  table.First;

after this i will edit the information on the dbgrid(datasource2 is setted to it), at this time the event must fire (if you have a design time component it will)

thanks for answers, Vijay

A: 

the code does'nt have calculated fields, thanks idsandon for reminding me...

Vijay Bobba