how to dynamic to create the calc field in the virtua table??
Posted: Tue 29 Mar 2005 07:33
as my topic.
Discussion forums for open issues and questions concerning database tools, data access components and developer tools from Devart
https://forums.devart.com/
Code: Select all
var
cfld : TFloatField;
implementation
procedure TForm1.Button1Click(Sender: TObject);
begin
//Assume that all fields are added to Fields list before.
VirtualTable1.Close;
cfld := TFloatField.Create(self);
cfld.FieldName := 'CalcFld';
cfld.Calculated := true;
cfld.DataSet := VirtualTable1;
VirtualTable1.Open;
end;
procedure TForm1.VirtualTable1CalcFields(DataSet: TDataSet);
begin
cfld.Value := DataSet.FieldByName('EmpNo').AsInteger + DataSet.FieldByName('Sal').AsInteger;
end;