Page 1 of 1
Detail dataset closed in master-detail
Posted: Mon 18 May 2015 20:41
by AdamKG
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
Re: Detail dataset closed in master-detail
Posted: Tue 19 May 2015 08:18
by AlexP
Hello,
Thank you for the information, we have reproduced the problem and will try to fix it in the nearest future.
Re: Detail dataset closed in master-detail
Posted: Mon 15 Jun 2015 11:55
by AlexP
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.
Re: Detail dataset closed in master-detail
Posted: Mon 17 Aug 2015 09:19
by AdamKG
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?
Re: Detail dataset closed in master-detail
Posted: Tue 18 Aug 2015 07:54
by AlexP
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.
Re: Detail dataset closed in master-detail
Posted: Tue 18 Aug 2015 08:02
by AdamKG
It will be like that in next release?
Re: Detail dataset closed in master-detail
Posted: Thu 20 Aug 2015 08:05
by AlexP
We plan to release the new version next month.