Nizam Muhammed
Nizam Muhammed

Reputation: 21

how insert the row values from a window to another window's dw in power builder

I have two windows and each have one data window. I just want to double click on first window's data window to get the second window's data window and want to add the selected row from the second window's data window to the same fields of first. How can I make it possible?

Upvotes: 0

Views: 1142

Answers (2)

Syed Muhammad Qasim
Syed Muhammad Qasim

Reputation: 11

//On duoble click of window 1 datawindow
long ll_row
Window2 lw_win
//get selected row on other window 2
ll_row = lw_win.dw_2.getselectedrow(0)
IF ll_row > 0 THEN
    dw_2.RowsCopy(ll_row, ll_row, Primary!, dw_1, dw_1.rowcount()+1, Primary!)
END IF

Upvotes: 1

Matt Balent
Matt Balent

Reputation: 2397

Many assumptions are being made but in a nutshell:

//in the doubleclick event on window1.dw_1
long ll_row, ll_newrow
//get selected row on other window
ll_row = window2.dw_2.getselectedrow(0)
IF ll_row > 0 THEN
   ll_newrow = dw_1.insertrow(0)
   dw_1.setitem(ll_newrow, 'colname1', window2.dw_2.getitemnumber(ll_row, 'colname1')
   dw_1.setitem(ll_newrow, 'colname2', window2.dw_2.getitemstring(ll_row, 'colname2')
   // and so on
END IF

There are many other ways to achieve the same thing based on what you are trying to do after you have copied the row from one place to another.

Upvotes: 0

Related Questions