1. Mike Trainor
  2. PowerBuilder
  3. Wednesday, 17 February 2021 20:32 PM UTC

I'm working on a nested report which has multiple masters and details.

By using a datastore I can insert rows into the datastore (which uses the same datawindow as the nested report).

I can copy the data from the datastore to the first nested report using

dw_1.object.dw_detl[1].object.data = dw_data.object.data

Then I repeat this operation for the second master/detail set and copy the data again.

dw_1.object.dw_detl[2].object.data = dw_data.object.data

Now the second nested report is fine, but the first nested report has vanished.

At the end of my report only the last nested report is correct, all the prior nested reports have vanished.

How do I maintain the data for all nested reports for each master?

 

Mike Trainor Accepted Answer Pending Moderation
  1. Thursday, 29 April 2021 17:54 PM UTC
  2. PowerBuilder
  3. # 1

Hi Chris,

I was sidetracked for a bit but I'm back on this now. And I've resolved the issue.

None of the above will ever work.

My scenario is very much like the one described in the PowerBuilder help referring to Nested Reports.

A freeform report with a tabular or grid report as the nested report,  although I'm using an external data window for the nested report and it seems it has different properties when it's nested.

First, InsertRow(0) does not work for the nested report. Period.

I came across a discussion that said we could simply us dot notation to add a row.

I found that       dw_1.object.dw_detl[1].object.empl_name[1] = "Mike Trainor"    will add a row even though insert row had not been used.

Secondly, big issue, the rows must all be added after all  the "Master datawindows" had been added. In other words,

if the above script is used after the first master is added it will vanish when the second master is added.

But this works after all the master have been added.

 

dw_1.object.dw_detl[1].object.empl_name[1] = "Mike Trainor"  (this will add to the first master)

dw_1.object.dw_detl[2].object.empl_name[1] = "Evan Trainor" (this will add to the second master)

 

So all details are first added to a datastore which has all the columns contained in  the nested report , plus one to identify which header it belongs to , then at the end I loop through all rows in the datastore and add them to the nested report. A bit of code is needed to compute the row number for the nested report. Each group should beginning at one.

 

I don't know if this a bug or not, but not being able to insert row should at least be better explained.

 

Regards, Mike

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 29 April 2021 18:30 PM UTC
Hi Mike;

Super glad that you found a "workaround!!

Yes, the InsertRow() or even "Import" commands should work on a child DWO. If you have a simple repeatable test case, please open a Support Ticket.

Regards ... Chris

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 17 February 2021 20:47 PM UTC
  2. PowerBuilder
  3. # 2

Hi Mike;

  Those operations should not have left only the last Child DWO's data displayed.

   Have you tried using a GroupCalc() command after the last child DWO's data is copied?

FWIW: A ShareData() would be more efficient that an a buffer Copy that you are doing.   ;-)

Regards ... Chris

Comment
  1. Mike Trainor
  2. Wednesday, 17 February 2021 21:31 PM UTC
Hi Chris, hope all is well.

I've used so many methods to get this to work, but no luck so far. I just tried the " dw_data.ShareData(dw_1.object.dw_detl[li_hdr])" and it threw an error, There isn't a ton of data so whatever works.



I display a messagebox after completing each master/detail so I can see that the first master/detail set processes perfectly, but after the second master/detail the details I had seen for the first set has vanished and the last set is correct. Yes, I did try adding GroupCalc() at the end. It did nothing.

I should have mentioned that my nested report is an external datawindow. I used this because I have to sum hours into one of 14 cells. 2 for each day of the week and it was easier to do the math in the code rather the using computed fields and summing 14 times. Plus 6 tax groups.



Thanks for the quick response.

Mike

  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 17 February 2021 21:43 PM UTC
Hi Mike;

Ahhh ... if the ShareData() errors out then that might explain the DOT notation copy also failing silently. Check to make sure that the DS's DWO and the DC's Nested Child DWO's have the *exact* same result set expectations. That not only means the same number of columns but also their data types and even column order must be *exactly* the same for these operations to work.

Regards ... Chris
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.