Performance problem

cgi

Member²
On a dataset with several Fields "FieldKind=fkLookup' but without field" FieldKind=fkCalc'.

When the property "AutoCalFields = True"
= > Problem of performance.
When the property "AutoCalFields = False", => no problem of performance but the fields "FieldKind=fkLookup' are not refreshed in insertion mode!!

Is somebody has an explanation?

------------------
Christian Gincheleau
 
Originally posted by mkalter:
Perhaps one or more lookup tables are very large?


No, lookup tables are not very large.

But which is the relationship between the property "AutoCalcFields"
and the fields of the type "FieldKind=fkLoopkup"
and why they are badly refreshed when the property "AutoCalcFields=False".

I am obliged to write the following code on the event "OndataChange"
of the "dataSource" connected to the "DataSet" :

procedure TAffaireDM.dsCdeLigneDataChange(Sender: TObject; Field: TField);
var
i : integer;
begin
if Assigned(Field) then
begin
if not Field.IsNull then
begin
for i := 0 to Field.DataSet.FieldCount - 1 do
begin
if Field.DataSet.Fields.FieldKind = fkLookup then
if Field.DataSet.Fields.KeyFields = Field.FieldName then
Field.DataSet.Fields.Value := Field.DataSet.Fields.LookupDataSet.FieldByName(Field.DataSet.Fields.LookupResultField).Value;
end;
end;
end;
end;

------------------
Christian Gincheleau
 
If AutoCalcFields = False, lookups are not automatically performed. This does not explain the actual performance problem of course.

------------------
Marco Kalter
Allround Automations
 
Back
Top