Solved

PowerBuilder 11.5 Nested Reports on Datawindow and GetChild

Posted on 2013-01-28
3
2,110 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
[X]
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
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
"Black Box" Testing of Control System Software 2 98
Help Required 2 46
jboss 7.1 start up error 1 64
ejb message driven bean mdb creation steps 2 37
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is about my first experience with programming Arduino.

730 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