Solved

PowerBuilder 11.5 Nested Reports on Datawindow and GetChild

Posted on 2013-01-28
3
1,943 Views
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
LOOP
ls_dw_all_objs = this.Describe("DataWindow.Objects")
inv_string.of_parsetoarray(ls_dw_all_objs,"~t",ls_dw_objs)
ls_dw_all_objs=""
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
			else
				ls_dw_all_objs += "     no-SELECT-found"+lineend
			end if
		else
			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
			else
				ls_dw_all_objs += "    "+ls_dwc_select+lineend
			end if
		end if
	end if
NEXT 
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
OpenWithParm(w_debug_info,ls_msgout)

Open in new window



This:

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?
0
Comment
Question by:virtuadept
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
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.
0
 
LVL 8

Author Closing Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A short article about problems I had with the new location API and permissions in Marshmallow
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now