Can two ProBindingSource on parent-child DataSet queries aut

Posted by dlauzon on 22-Aug-2012 08:00

From documentation:

In general, when you want to display child records in a separate control from the parent record,
you create multiple ProBindingSources. You bind one ProBindingSource to the parent table’s
navigation query and bind a different ProBindingSource to each child’s relation query, as shown
below:

rCustBindS = NEW Progress.Data.BindingSource(dshdl:TOP-NAV-QUERY(1)).
rCustGrid:DataSource = rCustBindS.
rOrderBindS = NEW Progress.Data.BindingSource(dshdl:GET-RELATION(1):QUERY).
rOrderGrid:DataSource = rOrderBindS.
rOlineBindS = NEW Progress.Data.BindingSource(dshdl:GET-RELATION(2):QUERY).
rOlineGrid:DataSource = rOlineBindS.

I tried that on two UltraGrid under OE10.2B06, the 1st UltraGrid connecting to it's own PBS with Handle property to <dataset>:TOP-NAV-QUERY(1) and the second having it's own PBS with Handle = <dataset>:GET-RELATION(1):QUERY, both PBS have AutoSync = TRUE.

The records show up correctly in the Parent UltraGrid, but the Child UltraGrid isn't refreshed when the selected record changes in the Parent UltraGrid.

The only way I got it to work is to subscribe to PositionChanged on the Parent PBS and to call <dataset>:GET-RELATION(1):QUERY:QUERY-OPEN()

The DataSet's parent-child relation defaults to "SELECTION" (no "REPOSITION" specified) so I presumed that:

"When navigating a filled ProDataSet object with a SELECTION  relation, related data is filtered as it is browsed. This means the child  query of the relation is filtered to make available only children of the current  parent, and the query is re-opened each time the parent table is repositioned."

And a re-opening of the child Query should update it's PBS because its AutoSync = TRUE:

Indicates whether the BindingSource object  automatically synchronizes (refreshes) all data displayed in any bound .NET  control after one of the following ABL operations on the bound ABL data source  object occurs:

and

When TRUE, the BindingSource object  automatically synchronizes the data displayed in any bound .NET control.  When FALSE, the application must handle this synchronization. The default value  is TRUE.

Are there any circumstances that prevent all these mechanism to apply when clicking a record in the parent UltraGrid?
I tried the UltraGrid with both Multiple and Single selection and it didn't affect this.

Does anyone have that specific setup working?

All Replies

This thread is closed