Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing whether or not a nested report returned rows

Status
Not open for further replies.

PowerbuilderAngel

Programmer
Jan 8, 2003
3
US
Hello All,

I have another question. I have a nested report. I pass in 3 arguments from the base report to the nested report. One of the arguments is a balance field. The nested report displays a balance which is computed based on a balance that was passed in via argument from the base report and another field on the nested report. If the nested report does not produce any rows then I cannot display the balance because this balance only exists on the nested report. There is a balance on the base report, but I pass it in to the nested report because there is field that needs to added to the balance and the a new balance is generated on the nested report, but like I previously stated if no rows are returned from the nested report I still need to display the balance on the base report. How can I capture whether or not the retriveal arguments of the nested report returned any rows so that I can display the balance that is on the base report. Please note the based report is grouped by an id.


Thanks guys, you all are so smart!
 
PBAngel,
From your description, I am "assuming" that you presently retrieve either one or zero rows of data. Depending on what you are using for a source for your nested datawindow, you should be able to modify the stored procedure to provide 0.00 values as a result set if there is not other data to retrieve. From your description, I am "assuming" that you presently retrieve either one or zero rows of data.

I have not had the opportunity to confirm that as an object of the report, you should be able to reference the nested datawindow and use the RowCount() function to determine if you have retrieved a record. If NestedDW.RowCount() works then you would probably be able to also use the NestedDW.InsertRow(0) to add a blank record and subsequent NestedDW.SetItem(1,"column_name",what_ever_value) to enter the desired values for display purposes.
 
PowerbuilderAngel,

Give your nested report a name such as "dw_Child" in its Properties in the base-reports layout. Then, from the surface of the window (PowerScript), you can do a GetChild() on the base report passing the nested report's name as an argument. Once you have a handle to the nested report, you can do whatever is possible on a ChildDataWindow object. You could place this script in the base report's RetrieveEnd! event:

/////////////////////////////////////////////////////////
long ll_Count ;
dataWindowChild ldwc_Obj ;
//
IF dw.GetChild( &quot;<nested-report>&quot;, ldwc_Obj ) > 0 THEN
ldwc_Obj.SetTransObject( SQLCA ) ;
ll_Count = ldwc_Obj.RowCount() ;
END IF ;

/////////////////////////////////////////////////////////


Regards,

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top