1. CJ Lai
  2. PowerBuilder
  3. Thursday, 7 October 2021 18:14 PM UTC

Hi 

setup - PowerBuilder 2017 R3

The following scenario is in one window.

I have an instance variable for a datawindowchild declared in Instance Variables tab (let's called is idwc_test) in a window.

I then have the variable initiated by calling dw_test.GetChild in a window function. It returns a row count and Finds rows per criteria in the function.

However, after getting out of the function, idwc_test does not seem to get any reference to the datawindowchild any more. Once out of the window function, where it was initiated and working fine, its row count become zero and the Find function returns -1

Is there something I need to add or do in order to have this instance variable work all throughout in the window?

Thanks

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 8 October 2021 07:28 AM UTC
  2. PowerBuilder
  3. # Permalink
Matt is very right. Probably you have to do another GetChild() before exiting the function (or wherever you use it again).
Comment
There are no comments made yet.
CJ Lai Accepted Answer Pending Moderation
  1. Thursday, 7 October 2021 19:11 PM UTC
  2. PowerBuilder
  3. # 1

Hi John

I failed to mention that I would do a SetItem to the dw_test and another SetItem to the idwc_test in the function.

After I get out the function, dw_test has newmodified! status and idwc_test's ItemStatus is NULL.

Thanks

Comment
  1. John Fauss
  2. Friday, 8 October 2021 01:17 AM UTC
A reference to a DataWindowChild object can go bad if you make changes to it, as Matt and Miguel have stated. This may very well be a root cause of your issue. I suggest you test by NOT making any changes to the DataWIndowChild, including the SetItem (???). Does the child DW auto-retrieve, retrieve with argument value(s)?.



FYI - I will be away from the Appeon Community for a few days. Thank you, Matt and Miguel, for jumping in on this thread - Please continue to assist CJ in my absence. Thanks!
  1. Helpful 1
  1. Miguel Leeuwe
  2. Friday, 8 October 2021 02:24 AM UTC
Lol, Yw, but ... me too I'll be away for a week, time for a small holiday.

regards.
  1. Helpful
  1. CJ Lai
  2. Friday, 8 October 2021 07:35 AM UTC
Thank you all very much for your input and help.

Per business' requirement, users would need to be able to add items into the dddw as process goes on. That is what the function is for. I thought skimpily just use an instance variable would make the modified dddw useful else where in the window. Apparently I was mistaken.

I had to, as Matt and Miguel suggested, call GetChild again outside of the main window to get the reference.

Thank you all very much again.

CJ
  1. Helpful
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Thursday, 7 October 2021 19:07 PM UTC
  2. PowerBuilder
  3. # 2

Not an answer but more of an FYI.  There are methods which can cause the datawindowchild to be 'lost'.  One situation is a modify of the child.allowedit property.  I'm sure there are others.

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 7 October 2021 18:41 PM UTC
  2. PowerBuilder
  3. # 3

Hi, C.J. -

What is the status of dw_test after the window function completes and you are checking the row count in the DataWindowChild? Does it continue to contain data or has its contents been reset?

Do you have a test case application you could share?

Best regards, John

Comment
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.