Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Datawindow - GetChild Error

Status
Not open for further replies.

PBFighter

Programmer
Jan 18, 2008
4
CA
Hi, first time poster. :p

Anyways, I'm relatively new to pb, so sorry if this question seems rather redundant but I haven't been able to figure out the problem, nor have the other developers here.

I have the syntax of a composite datawindow. It is formatted the way that I want it to be, in particular, the headers and footers are DESIGNED with objects (bitmaps etc) the way that I want it. However, I want to change the datawindowchild. I have retrieval arguments for the child, so changing the datawindowchild should be as easy as:

Step 1: Creating the datawindow
dw_main.Create(st_syntax, st_error)

Step 2: Changing the datawindowchild
dw_main.Object.dw_1.DataObject = 'd_new_child'

Step 3: Getting the child to retrieve
dw_main.GetChild('dw_1',dwc_1)

However, I always get an error on step 3. I couldn't find more documentation on GetChild besides the fact that -1 is an error (which it is) and am reaching my wits end. After doing step two and getting the name of the new datawindowchild object, it seems to set it correctly to the new one. And, when I don't bother changing it, and use the old one (skip step two) and use the GetChild it works fine, but with the wrong datawindowchild. Help would be appreciated. Thanks.
 
Have you tried getting the reference to the child as step 2 and then changing the datawindow object (after which you have to settransobject)?

Something like:

datawindowchild ldwc
integer lirc

lirc = dw_main.getchild("dw_1",ldwc)
ldwc.dataobject = 'd_new_child'
ldwc.settransobject(SQLCA)
ldwc.retrieve......

Matt

"Nature forges everything on the anvil of time
 
I tried that out but it seems that powerbuilder 8 doesn't like that. As suggested, after getting the Datawindowchild object, I tried setting the dataobject. However, I get the error, "Incompatible property dataobject for type datawindowchild".

Some other things that I have tried:
*I have also tried modifying the syntax string before creating the datawindow by replacing the datawindowchild string with the one that I want. In this case, I fail on the getchild call.

*Modifying the datawindow with:
dw_main.Modify('dw_1.DataObject=' + '"d_new_child"') (The child can change). This would replace what was done originally in step 2. Likewise, fail on the getchild call.

Essentially, whenever I've seemingly successfully changed the datawindowchild dataobject, I fail on the getchild call which is needed for retrieval.

Thanks for all your help, it's much appreciated.
 
Update: After a few more hours of struggling I arrived upon this snippet of documentation.

"You cannot use GetChild to get a reference to a report in a composite DataWindow when the report itself is a composite or nested DataWindow."

I'm speculating that this is the reason that my call to getchild is failing, and thus has become the bane of my existance. Is there any way around it? I tried to directly reference the child object by going:
dw_main.Object.dw_1.SetTransObject(sqlca)
and then hoping to go:
dw_main.Object.dw_1.Retrive(args)

Unfortunately, the former gives me the error:
"Error accessing external object property settransobject ..."

Thanks once again.

 
I'm trying to do the exact same thing. Also, I would like to modify the select syntax of the dwchild dynamically. I have found an article that talks about this, here is a sample code that could help you on your task. I haven't try this yet, but I believe it would work.

dw_main.SetTransObject(SQLCA)
dw_main.Modify("dw_1.DataObject = ~"d_new_child~"")
dw_main.Modify("dw_1.Nest_Arguments = ((~"'argument'~"))")
dw_main.Retrieve()

The third line of code, I think, is what you are looking for, here is a general syntax in case you have more than one argument.
( ("arg1") {,("arg2") {,("arg3") {,... } } } )

Here is the link to the article that talks about this:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top