cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Accessing nested report's data

Former Member
0 Likes
2,085

Okay I have a nested report, not a composite so GetChild is of no use, and I'd like to get to the data in the nested report. This kind of thing works very well:

For ll_loop = 1 to dw_1.RowCount()

     la_any = dw_1.Object.d_nested[ll_loop].object.data

     For ll_loop2 = 1 to UpperBound(la_any)

          ll_ref = dw_validation.Object.dw_property[ll_loop].object.ref[ll_loop2]

     Next

Next

The problem is when dw_1.Object.d_nested[ll_loop].object.data has no rows, a System Error occurs. I can't think of a way to check if there are any rows in advance. Long searches of the internet have turned up the following:

If long(dw_1.Object.d_nested[ll_loop].object.DataWindow.FirstRowOnPage) > 0

     This always returns 0 for me and I know I have data in my first few nested reports

IsNull(dw_1.Object.d_nested[ll_loop])

     This is never TRUE

IsValid(dw_1.Object.d_nested[ll_loop])

     This is never FALSE

Anyone have any other ideas this is driving me crazy, it looks like it should be so simple!!!!

Thank you for any help.

View Entire Topic
Former Member
0 Likes

Why not have datastore with the same dataobject as the nested report. Loop through the base report rows to obtain arguments and retrieve the datastore one base row at a time.

Former Member
0 Likes

The problem is we are loading the report from a saved PSR file and need access to the data in order to generate some charts and we can;t guarantee there is any database connection at that time. It's always more complicated than it should be

Former Member
0 Likes

wow. maybe the data would reveal itself if you did a saveas XML... long shot...

Former Member
0 Likes

One more thing you could do, is to load the PSR twice, one in a separate DS and the other on your original DW. In your DS, when you are going to access the nested report, modify a column's value first. It's going to be like this:

//If there's no row in the nested report this line below will insert one otherwise this will replace the column's value in row 1.

ds.object.nestedreport[i].object.columnX[1] = 1  

//Choose a column that supposed to contain a value (not null) when the row was loaded from PSR.

If IsNull(ds.object.nestedreport[i].object.columnY[1]) Then

  // Then this is a newly inserted row and this means the nested report was empty.

End If

The above is kind of ugly solution but I think would work in checking if the nested report contains a row when first loaded.

Former Member
0 Likes

I think this can be enhanced by just adding a dummy column to your nested report. Before looping through the nested report, set a value to the dummy column at row 1 and then check if the nested report contains only one row. If it has only one row, check if the value of the non-dummy columns are nulls or default values, if they are, then that nested report was empty and that lone row was just inserted when you set the value of the dummy column.