Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 datawindows over tabel in window

Status
Not open for further replies.

fhamelink

Programmer
Apr 28, 2002
2
NL
Hi All,

I've been working with PB for a while now.
But now I have come over a strange problem that looks very simple.
I have two datawindows in a window. Both datawindows are based over the same table.
First window shows nr and name
Second window shows nr name adress city etc (the whole table)
Now when I do a rowchange on the first window the second should pop up the right (rest) data.
But is is not happening.

I got these scripts:
On w_leverancier open:
dw_leveranciers.SetTransObject(SQLCA)
dw_leveranciers.Sharedata(dw_leveranciers%nr)
dw_leveranciers.Retrieve()
dw_leveranciers.SetRowFocusIndicator(Hand!)

On dw_first rowchanged:
integer li_rijnr
li_rijnr=dw_leveranciers.getitemnumber(currentrow,"nr")
dw_leveranciers%nr.Retrieve(li_rijnr)

Hope you guys can help
 
I think you are not using the sharedata feature of PB properly.

When 2 datawindows are sharing data, the retrieve is always on the basis of the sql statement of the primary datawindow which dw_leveranciers in your case (I assmume you are also refering it to as dw_first). So when you give a retrieve of dw_leveranciers%nr in the rowfocuschanged event, it does a complete retrieve of dw_leveranciers.

You can write alternate code to change the row focus in the secondary datawindow. Assuming both datawindows are sorted on nr , a simple code could be

integer li_rijnr
li_rijnr = currentrow

dw_leveranciers%nr.setrow(li_rijnr)
dw_leveranciers%nr.scrolltorow(li_rijnr)

If the sort order is not same, then maybe you have to write some extra code as

integer li_rijnr , li_row
li_rijnr=dw_leveranciers.getitemnumber(currentrow,"nr")
li_row = dw_leveranciers%nr.find('nr = '+string(li_rijnr),1,dw_leveranciers%nr.rowcount())
dw_leveranciers%nr.setrow(li_row)
dw_leveranciers%nr.scrolltorow(li_row)


I hope it helps in solving your problem

RTewari
 
He Rtewari,

Thanks for the reply. I used the sql statement so you can use the same data out of the buffer. I made a sql of containg all atributes.

Then made the following scripts:
On w_leverancier open:
dw_leveranciers.SetTransObject(SQLCA)
dw_leveranciers.Sharedata(dw_leveranciers%nr)
dw_leveranciers.Retrieve()
dw_leveranciers.SetRowFocusIndicator(Hand!)


On dw_leverancier%nr (second window) rowchanged:
dw_leveranciers%nr.ScrollToRow(currentrow)

You can put that currentrow right in without defining.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top