Page 1 of 1

Editing Current Master Record Changes Current Record in Detail Table

Posted: Thu 08 Feb 2018 08:05
by deonvn
Good day

I have a Firebird 3 database with a master-detail setup on two tables. Suppose that I am currently viewing the third record in the detail table. If I edit any field in the master record, the current record in the detail table is reset to the first record.

Example:

Code: Select all

MasterTable.Edit;
  while not(DetailTable.Eof) do
    begin
      MasterTable['TotalOrders'] := MasterTable.FieldByName('TotalOrders').AsCurrency + DetailTable.FieldByName('OrderValue').AsCurrency; // <-- resets detail table to first record
      DetailTable.Next;
    end;
MasterTable.Post;
This causes the program to go into an endless loop, since the detail table never gets passed the first record.

Is this expected behaviour?

PS: CachedUpdates = False | LocalMasterDetail = True

Thank you.

Re: Editing Current Master Record Changes Current Record in Detail Table

Posted: Thu 08 Feb 2018 12:38
by ViktorV
Yes, at the moment this is the correct behavior when using LocalMasterDetail. We will consider the possibility of changing it and let you know about the results.

Re: Editing Current Master Record Changes Current Record in Detail Table

Posted: Thu 08 Feb 2018 12:58
by deonvn
OK - thank you.

Re: Editing Current Master Record Changes Current Record in Detail Table

Posted: Fri 16 Feb 2018 09:00
by ViktorV
We will change the specified behavior in the next UniDAC build.