Editing Current Master Record Changes Current Record in Detail Table

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
deonvn
Posts: 2
Joined: Thu 08 Feb 2018 07:50

Editing Current Master Record Changes Current Record in Detail Table

Post by deonvn » Thu 08 Feb 2018 08:05

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.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

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

Post by ViktorV » Thu 08 Feb 2018 12:38

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.

deonvn
Posts: 2
Joined: Thu 08 Feb 2018 07:50

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

Post by deonvn » Thu 08 Feb 2018 12:58

OK - thank you.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

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

Post by ViktorV » Fri 16 Feb 2018 09:00

We will change the specified behavior in the next UniDAC build.

Post Reply