Master-detail: why doesn't detail DS automatically track row of master (i.e. :param not updated)?

Master-detail: why doesn't detail DS automatically track row of master (i.e. :param not updated)?

Post by kotodam » Sun, 09 Nov 2003 05:36:45


I have this:
master:
SqlQuery1 <- DataSetProvider1 <- ClientDataSet1 <- DataSource1

detail:
DataSource1 <-
SqlQuery2 <- DataSetProvider2 <- ClientDataSet2 <- DataSource2

The DataSource property of SqlQuery2 is DataSource1 (making SqlQuery2
the detail and SqlQuery1 the master). The SELECT statement in SqlQuery2
contains a parameter that gets its value from the master at runtime.

I compile and execute. Code contains:
ClientDataSet1.Open;
ClientDataSet2.Open;

ClientDataSet1's first row data appears in the controls hooked up to
DataSource1, and the detail rows for that 1st row appear in the controls
that are hooked up to DataSource2.

HOWEVER as I navigate through ClientDataSet1 (master) using TDBNavigator
or TDBGrid, the data in the detail are not automatically updated... I.e.
I am expecting the visual controls hooked up to DataSource2 to change
based on the currently selected row of ClientDataSet1.

What am I doing wrong?

Thanks.
 
 
 

Master-detail: why doesn't detail DS automatically track row of master (i.e. :param not updated)?

Post by Delph El » Sun, 09 Nov 2003 06:51:38

Thanks Bill. That worked (I needed a to add a link datasource for
master first).

Now I have:

Master SqlQuery
Master DataSource(link) (dataset prop=mast. sqlquery)
Master DataSourceProvider (dataset prop=mast. sqlquery)
Master ClientDataSet (ProviderName prop=mast. prov.)
Master DataSource (dataset prop=mast. ClientDataSet)
Master Vis Ctrls (datasource prop=mast. datasource)
Detail SqlQuery
(contains :param, datasource=Master DataSource(link))
Detail ClientDataSet
(ProviderName=blank,
DataSetField prop=fkData field in mast. ClientDataSet)
Detail DataSource (dataset prop=detail clientdataset)
Detail Vis Ctrls (datasource prop=detail datasource)

When I opened the clientdatasets and navigated through the master cds,
the detail vis. ctrls changed the way they are supposed to.

-kotodama