-
Krishna Mohan Gullap
- PowerBuilder
- Wednesday, 14 May 2025 12:06 PM UTC
Hi there PowerBuilder gurus -
So, here is the problem statement. I have a composite Datawindow which has 2 simple sub-reports within it
Composite Datawindow: The composite datawindow is retrieved using a Stored Procedure and has the columns company id, profit ctr id, location, and tracking number in the output dataset (Pls refer attachment Composite-DataObject-Layout. Unable to provide the pictures inline)
Parameter mapping for the Sub-reports: Both the sub-reports are retrieved based on the value of company id, profit ctr id, location and tracking number for each row in the Composite dataobject (Please refer attachment Sub-Report-Mapping. see how the parameters are mapped to the column values of the Composite dataobject)
So, the sub-reports will get retrieved once for each row retrieved in the Composite dataobject. If there are, say 10 rows retrieved in the Composite dataobject, there will be 10 instances of dw_2 (Sub-report in this case) retrieved on the report
Since these are simple reports, I know I can use GetChild to get a reference to the sub-report. But, can you tell me a way to obtain the individual instances of these Sub-reports. In the above example, in the Composite report, there could be 10 instances of dw_2 getting retrieved since there are 10 rows in the Composite dataobject
I tried running a loop through the rows in the Composite dataobject and obtain an instance of the Sub-report dw_2, but that didn't seem to work. Sample code below:
For li_row = 1 to dw_composite.RowCount()
li_rc = dw_composite.GetChild('dw_2[1]', ldwc_dw2)
Next
At this point, it appears I need to retrieve the sub-report again by looping through the rows of the Composite Datawindow and obtaining the values of company id, profit ctr id, location, and tracking number and passing them as arguments to the DWChild (which is easy to do) and I can't just fetch the second or third instance of the Sub-report and fetch the data (What I do after getting this data is to use OLE and put them all in a spreadsheet that the user can use for their daily work, in the same format it is displayed while the Composite dataobject is retrieved)
Maybe I am doing something stupid. Any suggestions? Please let me know if you need more information or clarity
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.