Powerbuilder : How to Get the RowNumber of specific data on datawindow

4.4k views Asked by At

Good Day!, Can anyone here give me a hint or idea on how to get the rownumber of specific value in datawindow.

i have 2 objects, treeview and datawindow with same Value. Treeview data are sorted but in datawindow is not. when i click an item in Treeview it will show the rownumber in datawindow correspond to value clicked in treeview. How can i do that?

Best regards, Newnbie

P.S Sorry for my English

1

There are 1 answers

1
MicKr- On

I would use dw.Find(*). Code example:

long ll_row
string ls_keyValue, ls_dwSearch

// Read value from TreeView
ls_keyValue = '...'

// "MyKey" :: Column in DataWindow containing the key read from tree view
ls_dwSearch = "MyKey = '" + ls_keyValue + "'"
ll_row = dw_data.Find(ls_dwSearch, 1, dw_data.RowCount( ))

if ll_row > 0 then
   // Key value found => Make row current and visible
   dw_data.ScrollToRow(ll_row)
end if