• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2387
  • Last Modified:

PowerBuilder 11.5 Nested Reports on Datawindow and GetChild

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
virtuadept
Asked:
virtuadept
  • 2
1 Solution
 
virtuadeptAuthor Commented:
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
 
virtuadeptAuthor Commented:
This was my own question, not sure how I can grade my own (half) answer to my own question.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now