powerbuilderdatawindow

how to copy checked rows to another datawindow?


So I have two datawindows, and in the first DW I have a checkbox per row. Now, I want to copy/send the checked or selected rows to the 2nd DW on a click of a button. Can you please enlighten me on how to do this? TIA. :)


Solution

  • This depends upon how you have the datawindows set up. If they are using the same datawindow OBJECT you can simply use the RowCopy method.

    dw_1.rowsCopy(<start dw_1 row number>, <end dw_1 row number>, 
                  Primary!, dw_2, <dw_2 row number BEFORE which you wish to add
                  the rows>, Primary!)
    

    where dw_1 has the rows to copy and dw_2 is the target.

    If the datawindows use different datawindow objects (different number of columns, etc.) you need to loop through the source datawindow rows and do a series of SetItem calls to place the data into the target datawindow.