Detail dataset closed in master-detail

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
AdamKG
Posts: 18
Joined: Fri 13 Nov 2009 10:32

Detail dataset closed in master-detail

Post by AdamKG » Mon 18 May 2015 20:41

Hello,

I'm using master detail using two smart queries. Detail sql is with no parameters and MasterSource, DetailFields, MasterFields are filled. Detail query has BeforeOpen event which changes its sql.text. When I change master record TCustomDADataSet.RefreshDetail runs BeforeOpen on detail query which puts it on inactive state. So in detail's AfterOpen query is closed and fields are not available.

I'm using ODAC 9.5.15 and Delphi XE3

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Detail dataset closed in master-detail

Post by AlexP » Tue 19 May 2015 08:18

Hello,

Thank you for the information, we have reproduced the problem and will try to fix it in the nearest future.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Detail dataset closed in master-detail

Post by AlexP » Mon 15 Jun 2015 11:55

On the query change, the DataSet is closed, and the onBeforeOpen method is called on record modification in the master DataSet. If you want to modify the query, you can use the onBeforeRefresh event.

AdamKG
Posts: 18
Joined: Fri 13 Nov 2009 10:32

Re: Detail dataset closed in master-detail

Post by AdamKG » Mon 17 Aug 2015 09:19

Hello Alex,

when I moved my code from detail's BeforeOpen to BeforeRefresh I still experience detail dataset closing. As a workaround I can issue in BeforeRefresh dsDetail.Open, but then Detail query is executed twice.
Can You please give me an example how can I change detail's query sql based on current values from master?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Detail dataset closed in master-detail

Post by AlexP » Tue 18 Aug 2015 07:54

We have fixed this behavior. From now, you can use the onBeforeOpen event, and the Detail DataSet will remain open at this.

P.S. From now, this event will be called on explicit DataSet opening only.

AdamKG
Posts: 18
Joined: Fri 13 Nov 2009 10:32

Re: Detail dataset closed in master-detail

Post by AdamKG » Tue 18 Aug 2015 08:02

It will be like that in next release?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Detail dataset closed in master-detail

Post by AlexP » Thu 20 Aug 2015 08:05

We plan to release the new version next month.

Post Reply