DetailFields should have same number of items as MasterFields

title says it all, i get the above error on a master detail link using mmwhere…
“DetailFields should have same number of items as MasterFields”
and i don’t get it cause i’m only linking 1 detail field to 1 masterfield
so what could cause this error?

Hi,

Can you create a simple testcase that reproduces this issue, pls?
you can drop email to support@ for keeping privacy.

found it i guess, it has to do with the fact that my child table was already opened when i set up the master detail link… as soon as the masterfield got set it triggered masterchanged and at that point the masterfields wasn’t already set in function TDADataTable.FetchMastersDetails_GenerateWhereStatement: TDAWhereExpression;

procedure TDAMemoryDataset.SetMasterFields(const Value: string);
begin
if (Value <> ‘’) and (Filter <> ‘’) then DatabaseError(SNoDetailFilter, Self);
if MasterDataLink.FieldNames <> Value then DataEvent(dePropertyChange, 0);
MasterDataLink.FieldNames := Value;
end;

Hi,

You can use cloned tables for such situation when detail table is already opened.

each cloned table can has own filter, m/d relation, active status

where do i find info in regards to cloned table?

Hi,

Look at the ClonedSource article

i have the impression that using mmwhere fetches records when a detail record is being added, is this correct?
situation:
i open the detail table (mmwhere) with remotefetchenabled:=False
afterwards i set remotefetchenabled:=true
after adding a new detail record the existing records that match the mmwhere are present in the detail table…

is this the expected behaviour?

Hi,

I think, the OnMasterChange event might be fired and data was fetched from server.

you may set breakpoint to FetchMastersDetails method and see callstack if you need more information.