Update of a VCL TClientDataSet (detail set) when its master data set is empty
Asked Answered
F

0

7

I have a master TClientDataSet, which is also a detail dataset. This dataset is named MasterDetail1.

Another dataset, DetailSet1, is a detailset of the MasterDetail1.

The query for DetailSet1 is

SELECT * 
FROM readoutprobe_containers 
WHERE id = :parent_container

Where the value of the parent_container parameter is obtained through a DataSource getting its data from the master data set.

As long as the MasterDetail1 dataset has more than one record, the DetailSet1 dataset shows appropriate data.

However, when the MasterDetail1 dataset is empty, the DetailSet1 dataset shows the last populated record from the MasterDetail1 data, which is wrong data. When the master set got no data, the detailset should show no data as well.

How to achieve an empty DetailSet1 when its master data is empty?

Filagree answered 25/6, 2021 at 17:40 Comment(1)
The symptoms you are prescribing look like MasterDetail1 has a poFetchDetailsOnDemand flag activated as detailed in the documentation here. I think you read FROM a temporary buffer at FROM readoutprobe_containers. I think it would be a good idea to either clear the on-demand flag, or to populate a fresh copy of the buffer everytime you fire the request.Organon

© 2022 - 2024 — McMap. All rights reserved.