Ultragrid: Falling over when attempting to Populate Child ro

Posted by MGreenwood on 03-Dec-2010 10:34

We have an application where a parent row may have child data.
What is required is to get the parent data and if there is child data and the user wishes to view it make a separate trip to return this data for the user.
Currently
------------
A query is run to populate the parent table in a dataset.  
    [DEFINE DATASET ds_ParentChild
  FOR tt_Parent, tt_Child
    DATA-RELATION FOR tt_Parent, tt_Child RELATION-FIELDS(ParentChildKey, ParentKey) NESTED. ]
The parent table contains a logical field that indicates if there is child data (hasChildData).
On the grid event BeforeRowExpanded
  IF the parent record “hasChildData” THEN
        A field is set on the parent record – GetChildDataForThisRecord
        A call is made to a procedure passing the dataset as an INPUT-OUTPUT parameter
  [Outputting the contents of the parent and child tables shows the parent has the same records and the child now has records related to the parent ]
In the called procedure all parent records where GetChildDataForThisRecord is true are found
   the child table is populated with records related to the parent record.
  The field GetChildDataForThisRecord is set to false.
When returning to the calling procedure an number of error (91) messages are shown indicating there are no parent records and the grid entries display no data.

Can anyone shed any light on why this behaviour may be occurring and suggest how it can be overcome so that the child data can be displayed in the grid.

All Replies

Posted by Wouter Dupré on 03-Dec-2010 10:40

Hi,

Thank you for your email. I'm currently out of the office for business. I will return on December 6. During my absence I will have no or very limited access to my email. For urgent matters, call me on my mobile and leave a message on my voice mail or call our office.

Best regards,

Wouter.

--

Wouter Dupré

Senior Solution Consultant

Progress Software NV

Stocletlaan 202 B| B-2570 Duffel | Belgium

Office +32 (0) 15 30 77 00 | Mobile +32 (0) 478 50 00 49 wdupre@progress.com

Posted by Peter Judge on 03-Dec-2010 13:50

Can anyone shed any light on why this behaviour may be occurring and suggest

how it can be overcome so that the child data can be displayed in the grid.

You may need to reopen the parent query. Is the GetChildDataForThisRecord() call returning parent records too?

-- peter

Posted by MGreenwood on 08-Dec-2010 05:34

Hi Peter,

sorry for the delay have had problems loggin in to the communities pages.

to answer your question

No the GetChildDataForThisRecord() call does not return parent data.

What the application is doing is returning a list of available products, some of which have special offers.

clicking on the [+] to expand the (special offer) child rows is being trapped by the "BeforeRowExpanded" event

at this point the call is made to get related special offers (if there are any). The data set is being passed as an input-output parameter.

Outputing the product and special offers temp-tables shows the only change was to add rows for the special offers temp-table.

I tried re-opening the parent query but that did not work.

One thing I failed to mention was that  on returning to the BeforeRowExpanded event we are executing a

  bindingsource2:RefreshAll().

Posted by MGreenwood on 08-Dec-2010 05:36

The concept we were trying to get working was to avoid returning all of the Special Offers at the same time.

The application would return the special offers for the products the users are interested in.

For now we are returning all of the special offers with the products.

This thread is closed