how to dynamic to create the calc field in the virtua table??

how to dynamic to create the calc field in the virtua table??

Postby akiraiu » Tue 29 Mar 2005 07:33

as my topic.
:(
akiraiu
 
Posts: 19
Joined: Tue 16 Nov 2004 02:31

Postby Paul » Thu 31 Mar 2005 11:26

Working with calculated fields in Virtual table is not different from BDE components. For example you can use next code:

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;
Paul
 
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Postby akiraiu » Tue 05 Apr 2005 13:39

Thx thx~~~~ :lol: :lol:
akiraiu
 
Posts: 19
Joined: Tue 16 Nov 2004 02:31


Return to VirtualDAC