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
Detail dataset closed in master-detail
Re: Detail dataset closed in master-detail
Hello,
Thank you for the information, we have reproduced the problem and will try to fix it in the nearest future.
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
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
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?
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
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.
P.S. From now, this event will be called on explicit DataSet opening only.
Re: Detail dataset closed in master-detail
It will be like that in next release?
Re: Detail dataset closed in master-detail
We plan to release the new version next month.