I discovered this during development and created a simplified setup to make sure there was actually a Unidac bug. There does appear to be, another serious one when interfacing Unidac with TClientDataSet.
I have a query which returns services items. Each item is keyed on a service order number and a service item number. My master query returns exactly one record. The detail query returns technicians scheduled for the service item. In my example, there are 55 records in the result set.
The component setup is like this...
MasterCDS->DataSetProvider
DetailDS->DetailSrcDSDataSetField
DataSetProvider->MasterSrcDS
MasterSrcDS->MasterSrcDsr
DetailSrcDS->MasterSrcDsr
This is a nested clientdataset scenario. When the master is open, only 1 record in the detail is returned. There should be 55 records. In fact, I can see the 55 records when the detail uniquery opens. The records are just not getting into the clientdataset, except for the first one.
I created a video illustrating the problem. The upper grid is the master query. The middle grid is the detail data in a clientdataset. The lower grid is attached to the uniquery acting as a datasource for the detail data.
http://www.mediafire.com/?yw3kk9wtl93reaz
Please tell me there is a Unidac setting I am missing and not another bug in basic operation. Thank you for any help you can provide.
How soon before the next release?
MIDAS Master/Detail Failure
-
- Posts: 40
- Joined: Thu 27 Jan 2011 22:31
I stumbled on the solution. Since nested datasets didn't work, I began to link master/detail on the client dataset side. When doing that, you have to specify the fields which make each record unique in the detail dataset. This required me adding two additional fields to the query since it's a compound key composed of 4 fields. When I turned on the clientdataset, it worked. That's a good sign.
Working on a hunch that maybe nested datasets with unidac need the fields too even if not specified in any property anywhere. So, I returned everything to the way it was except for the SQL. I left the 2 fields in the query. When I turned the query on, all of the details records appeared, not just the first.
I am not sure how or why unidac needs all of the primary key fields, especially when I didn't specify the fields in masterfields or indexfieldnames. It appears at this time to work.
As you can see in the video, the way Unidac interacts with clientdatasets is different from other data access technologies and confusing.
Working on a hunch that maybe nested datasets with unidac need the fields too even if not specified in any property anywhere. So, I returned everything to the way it was except for the SQL. I left the 2 fields in the query. When I turned the query on, all of the details records appeared, not just the first.
I am not sure how or why unidac needs all of the primary key fields, especially when I didn't specify the fields in masterfields or indexfieldnames. It appears at this time to work.
As you can see in the video, the way Unidac interacts with clientdatasets is different from other data access technologies and confusing.