Solved

PowerBuilder 11.5 Nested Reports on Datawindow and GetChild

Posted on 2013-01-28
3
1,989 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 83
C Programming - If Statement 8 72
Online file editor, manager 6 62
Not seen Link button 5 17
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

895 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

14 Experts available now in Live!

Get 1:1 Help Now