1. CJ Lai
  2. PowerBuilder
  3. Friday, 10 September 2021 14:08 PM UTC

Hi all

I have spent hours trying to get this done but to no avail.

Here is what I have

I have a dw control (let's call it dw_main) within it there is a column ('trouble') that is of edit style dddw (dropdowndatawindow).

I also have a datawindowchild (dwc_trouble) that has the reference to column 'trouble'. The property auto retrieve is off and it is retrieved from script with parameters.

Issue at hand

After I do a dw_main.Reset(), dw_main.Insertrow(0), AND dwc_trouble.Reset(), the dw_main got refreshed (clean slate). However, when I clicked on the column 'trouble' it still has the rows from previous retrieve. I also tried a dwc_trouble.retrieve(somebogusvalue) it still showed the old rows.

This is all in dw_main's itemchanged event.

Could you provide your insight/solutions?

Thanks

CJ

Shekar Reddy Accepted Answer Pending Moderation
  1. Monday, 13 September 2021 16:57 PM UTC
  2. PowerBuilder
  3. # 1

Try -

dwc_Trouble.POST Reset()

HTH

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 10 September 2021 20:46 PM UTC
  2. PowerBuilder
  3. # 2

CJ -

   Once the window/object has been opened, get a pointer to the CHILD dw:

     datawindowchild    l_dwc
     long                     ll_rc

     ll_rc = dw_main.GetChild ("trouble", ldwc)

     ll_rc = dw_main.Reset ()
     ll_rc = ldwc.Reset ()


     // To scroll to the correct row
     ll_row = ldwc.Find ("trouble = 'Earthquake' ")
     IF (ll_row > 0) THEN

           ll_rc = ldwc.ScrollToRow (ll_row)

     END IF

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Friday, 10 September 2021 18:52 PM UTC
  2. PowerBuilder
  3. # 3

are  you getting the childdatawindow each time before the reset?

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 10 September 2021 14:30 PM UTC
  2. PowerBuilder
  3. # 4

The ItemChanged event is not a good place to be performing these operations, CJ. The ItemChanged event fires when the DW's edit control (what the user inputs/selects data into) has new or changed data that needs to be placed into a row/column cell, but has not yet done so. The methods you're calling are really not appropriate under those circumstances.

I suggest you find a better place/event to perform these actions.

If that is not feasible, you might try POSTing these function calls from ItemChanged instead of triggering (the default method of calling function and events), but I cannot guarantee that will work. If you could perhaps explain the conditions under which you need to perform these actions, we might better understand the situation and offer you a better option to try.

Best regards, John

 

Comment
  1. CJ Lai
  2. Friday, 10 September 2021 14:54 PM UTC
Hi John

Here is what the app should be doing

- user inputs into one other column in dw_main, say Color

- when they tab out of the Color column, the column 'trouble' should then populate (retrieve with value from Color) a list of product names of such color (dwc_trouble will have a list of names)

- If there is no row retrieved into dwc_trouble, both dw_main and dwc_trouble will get reset (but dwc_trouble still retains previous records)

- I just tried to call the dwc_trouble.reset() from a button control (clicked!) in the same window. It didn't rid of those previously retrieved rows in dwc_trouble



I hope this will help you help me

Thank yuo
  1. Helpful
  1. John Fauss
  2. Friday, 10 September 2021 15:59 PM UTC
That helps, but I'm still confused. Your statement "If there is no row retrieved into dwc_trouble, both dw_main and dwc_trouble will get reset (but dwc_trouble still retains previous records" is confusing.

1. If no rows in the dddw for column "trouble" are retrieved, you want to clear the entire dw_main datawindow, or clear the column "color"?

2. If no rows in the dddw for column "trouble" are retrieved, the dddw for column "trouble" will be empty. You want reset the child DW but somehow the child DW retains previous records? This sounds to me like you want the dddw to be empty and populated at the same time. Which is it???? Very confusing.
  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.