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
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
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