PowerBuilder 11.5 Nested Reports on Datawindow and GetChild

Posted on 2013-01-28
Last Modified: 2013-02-13
I need to come up with a debugging tool to programatically check a datawindow if there are any nested reports, and if so, to report what the parameters being passed to the nested report are (parm name and the values that are passed in, lets say duing SQLPreview event of the parent dw). I could modify the parent dw to do something to show this. But ideally I will not have to touch every datawindow to do it, ideally there is a way to just inspect. I am using PFC and have a u_dw for these, if that helps. I can see what is being passed to the parent dw, and I already have code to grab the objects on that and see that there are "report" on it, so I know the objects to try to do a GetChild on, but it fails.

Sample code of what I tried, in my modified u_dw.

string ls_msgout, ls_type, ls_dwc_select
string ls_ancestor_tree, lineend
string ls_dw_all_objs, ls_dw_objs[]
int idx
n_cst_string inv_string
DataWindowChild ldwc

ClassDefinition cd_windef
ClassDefinition cd_ancestor
lineend = "~r~n"
cd_windef = Parent.ClassDefinition
cd_ancestor = cd_windef
ls_ancestor_tree = "Ancestor tree: " + lineend
DO WHILE IsValid(cd_ancestor)
	ls_ancestor_tree = ls_ancestor_tree + cd_ancestor.Name + lineend
	cd_ancestor = cd_ancestor.Ancestor
ls_dw_all_objs = this.Describe("DataWindow.Objects")
FOR i = LowerBound(ls_dw_objs) to UpperBound(ls_dw_objs)
	ls_type = this.Describe(ls_dw_objs[idx]+".Type")
	ls_dw_all_objs += "["+ ls_dw_objs[idx] + "].[" + ls_type +"]" +lineend
	if ls_type = "report" then
		if this.GetChild(ls_dw_objs[idx], ldwc) > 0 then
			ls_dwc_select = ldwc.GetSQLSelect()
			if ls_dwc_select <> "" then
				ls_dw_all_objs += "     "+ls_dwc_select+lineend
				ls_dw_all_objs += "     no-SELECT-found"+lineend
			end if
			ls_dwc_select = this.Describe(ls_dw_objs[idx]+"[1].Datawindow.Table.Select")
			if isnull(ls_dwc_select) or ls_dwc_select = "" then
				ls_dw_all_objs += "     no-child-found"+lineend
				ls_dw_all_objs += "    "+ls_dwc_select+lineend
			end if
		end if
	end if
ls_msgout = "dwo: "+this.dataobject+lineend+lineend
ls_msgout += "dw objs: "+ ls_dw_all_objs +lineend +lineend
ls_msgout += "sqlselect: "+this.GetSQLSelect() +lineend +lineend
ls_msgout += "ancestors: "+ls_ancestor_tree + lineend + lineend

Open in new window


if this.GetChild(ls_dw_objs[idx], ldwc) > 0 then

returns a -1, even though from the output I verified that the name is correct of the "report".

Any ideas?
Question by:virtuadept
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

virtuadept earned 0 total points
ID: 38880875
To answer (sort of) my own question, you have to set "processing = 5" for GetChild() to work on "report" objects in your datawindow. So before the GetChild I do this:

Any la_proc

//processing is set 5 so GetChild works, saving prior value first
la_proc = this.object.datawindow.processing
this.object.datawindow.processing = 5

And after I do this:

// set processing back to prior value
this.object.datawindow.processing = la_proc

However, this still didn't help me much becuase I still haven't figured out a way to dynamically determine what the retrieval arguments are/were for a datawindow (or a child dw), either before or after retrieve.

I mean, I know what they are, I just don't know what the VALUES are. dw.Describe("Datawindow.Syntax") will show me the arguments, but not what they are.

If anyone can help on the Arguments question you can get the points for this one I already answered, otherwise I'll ask it in a different question a bit later on.

Author Closing Comment

ID: 38885357
This was my own question, not sure how I can grade my own (half) answer to my own question.

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
Six Sigma Control Plans
Introduction to Processes

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question