1. Raymond Longoria
  2. PowerBuilder
  3. Wednesday, 22 June 2022 19:50 PM UTC

I am embarrassed about this because it is very easy yet I cannot get this to work. I am sure I am overlooking something very obvious.

In Powerbuilder 2021, in a window I have a datawindow (dw_main) whose datasource has a dddw. On the open event of the window I run the following code. I traced the code and the return values are all good and 3 rows are retrieved with the datawindowchild yet the datawindow in the window is blank. I copied the code from other windows that are doing the same thing yet it does not work here. 

datawindowchild ldwc_child

dw_main.Settransobject(SQLCA)
li_rtn = dw_main.Getchild("prj_nbr", ldwc_child)
li_rtn = ldwc_child.Settransobject(SQLCA)
ll_rtn = ldwc_child.Retrieve()
ldwc_child.Insertrow(0)

 

Any help will be greatly appreciated.

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 22 June 2022 20:26 PM UTC
  2. PowerBuilder
  3. # Permalink

Last statement: Perform the InsertRow(0) on the DataWindowControl, not the DataWindowChild, e.g., dw_main.InsertRow(0).

If the prj_nbr column object has the "AutoRetrieve" property checked in the Edit tab and there are no retrieval arguments, then you do not need to perform the SetTransObject and Retrieve for the DataWindowChild.

Comment
  1. Raymond Longoria
  2. Wednesday, 22 June 2022 21:04 PM UTC
John,

That worked! Gosh I am humbled and thankful at the same time!
  1. Helpful
  1. John Fauss
  2. Thursday, 23 June 2022 01:35 AM UTC
That's great news, Raymond!

Unless a data row is present (even a new/empty one), the DataWindow control cannot render the DW data object - so the DW control remains "blank". Same for the DataWindowChild... if it is empty (no data rows), then when the drop-down is opened the contents of the drop-down will be blank. Enabling the Auto-Retrieve property takes care of the frequent cases where the DataWindowChild does not utilize any retrieval arguments, so you do not to have to code it yourself.
  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 22 June 2022 20:24 PM UTC
  2. PowerBuilder
  3. # 1

Hi Raymond;

  I do not see any Retrieve on the Parent DWO - only the child? Is the InsertRow supposed to be for the Parent DWO?

Regards ... Chris

Comment
  1. Roland Smith
  2. Wednesday, 22 June 2022 21:01 PM UTC
I think that is it, inserting into the child so dw_main has no rows.
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.