1. Kevin Thai
  2. PowerBuilder
  3. Tuesday, 21 February 2023 19:55 PM UTC

Hi all,

I am wondering if anyone can help with this? I currently have a report datawindow inside a parent datawindow. I am running into an issue where inserting a row into the Parent Datawindow causes the child to ask for retrieval arguments. Is there a way for the child datawindow not to ask for the arguments?  The code that I am using is currently below:

 

Where :

dw_1 = Parent Datawindow

dwc_1 = Child Datawindow

---------------------------------------------------------------

dw_1.settransobject( sqlca)
dw_1.retrieve( )

dw_1.getchild("dw_child",dwc_1)
dwc_1.settransobject(sqlca)
dwc_1.retrieve("arguments here")

dw_1.insertrow(1)

Accepted Answer
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 1 March 2023 11:18 AM UTC
  2. PowerBuilder
  3. # Permalink

Can you try this?

Instead of 

dw_1.getchild("dw_child",dwc_1)
dwc_1.settransobject(sqlca)
dwc_1.retrieve("arguments here")

Modify the last line to

dw_1.getchild("dw_child",dwc_1)
dwc_1.settransobject(sqlca)
If dwc_1.retrieve("arguments here") = 0 Then dwc_1.InsertRow(0)

I'm not sure whether the appearance of the report will be OK, if there is an empty row....

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Wednesday, 22 February 2023 00:06 AM UTC
  2. PowerBuilder
  3. # 1

When the Child dw has retrieval arguments, Disable/uncheck the AutoRetrieve property in the Edit Style in the DW painter.   In the retrieveend event of the dw control, retrieve the child dw's data... here's part of my code

ll_TmdeID = this.GetItemNumber( 1, "tmde_id")
this.GetChild('tmde_attachments', ldwc_tmde_doc)
ldwc_tmde_doc.SetTransObject(sqlca)
ldwc_tmde_doc.Retrieve(ll_TmdeID)

It may be possible to declare the DataWindowChild as an instance variable, then GetChild and SetTransObject in the dw's constructor... but I haven't tried that.  I just do it all in the retrieveend event of the dw.

The key is to disable the AutoRetrieve property and retrieve the child through script.

Hope this is helpful,
~~~Tracy

 

Comment
  1. Kevin Thai
  2. Tuesday, 28 February 2023 18:03 PM UTC
Hi,



Sorry to the late responses. I am currently using a report object in my datawindow and cannot seem to find the option for the autoretrieve in the painter. Is there a better way to include a datawindow inside another datawindow?



Thanks,

Kevin
  1. Helpful
  1. John Fauss
  2. Wednesday, 1 March 2023 03:24 AM UTC
@Kevin - with the limited information you've supplied, we're pretty much reduced to guessing as to the cause of the issue you are having. I suggest you export the source for the main report DataWindow and the "child" DataWindow(s), creating .srd files, then zip the .srd files into one .zip file and attach this to a new reply in this thread (you cannot attach a file in a comment) so that we can inspect how you have these defined, and see what the retrieval arguments are for each. This should give us a more clear picture of what you are doing and hopefully, eliminate several rounds of "Try this..." and "What if you..." back-and-forth interaction.



@Tracy - While it is certainly possible to define a DataWindowChild reference variable as an instance variable, there is a potential pitfall: If you use Modify or dot notation to modify certain child datawindow properties, this can invalidate the DataWindowChild object and require you to issue the GetChild method again to renew/refresh the object reference. Of course, this can happen with local DataWindowChild reference variables, too, but instance variables typically exist for longer intervals and can be used in multiple methods.
  1. Helpful 1
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 21 February 2023 23:53 PM UTC
  2. PowerBuilder
  3. # 2

In the top-level DWO, click on the nested DWO. You will get an interface that allows you to insert fields from the parent DWO.

In your case, that means your retrieval into the parent DWO must include the field that you will pass to the child/nested DWO. In the interface described above, select that field and use it to pass the required value to the child/nested DWO.

Comment
  1. Tracy Lamb
  2. Tuesday, 28 February 2023 19:45 PM UTC
Sorry, I thought you wanted to supply the retrieval argument for a Child drop-down datawindow, not a dw with nested reports. Click on the nested reportd.

If the poperties panel isn't already openend, right-click on the nested report to select "properties". On the general tab, at the bottom, enter your argument(s).
  1. Helpful
  1. Tracy Lamb
  2. Tuesday, 28 February 2023 19:58 PM UTC
Auto-retrieve applies to single fields with the DropDownDW edit style. If that's the case, open the properties panel, click on Edit, There's a check-box for AutoRetrieve.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.