Hello
It is not good idea to use Calc Fields for long calculations.
DataSet doesn't guarantee that OnCalcFields would be called only once on open.
DataSet calls OnCalcFields even when you go throw the dataset (Next, Prev).
and calculate Calc fields on the fly.
I would advice to use DataDriverEh.OnReadRecord event.
I is called once for every record that MemTableEh gets from DataDriverEh.
Create new physical field in MemTableEh that you will fill by calculation:
This is the expample of using the event:
Code:
procedure TfFishForm.DataSetDriverEh1ReadRecord(DataDriver: TDataDriverEh;
MemTableData: TMemTableDataEh; MemRec: TMemoryRecordEh;
var ProviderEOF: Boolean);
begin
// Call standart reading method
DataDriver.DefaultReadRecord(MemTableData, MemRec, ProviderEOF);
// Calc and assign new fields
// 'NewField' = 'VendorName' + ' (' + 'Address1' + ')'
MemRec.DataValues['NewField', dvvValueEh] :=
VarToStr(mtVendors['VendorName']) + ' (' + VarToStr(mtVendors['Address1']) + ')';
end;
end;
Best regards
Admin