PowerBuilder Datawindow Grid delete selected rows efficiently

less than 1 minute read

Today I wanted to delete the selected rows of a datawindow grid in Powerbuilder. When I say delete I wanted just to remove them from the screen and not from the database. I used deleteRow(long row) function but it was slow in large datasets. So I asked my departments head and he gave me a very nice and efficient approach:

// move selected rows to Filter Buffer
dw_vehicles.Setfilter("NOT isselected()")
dw_vehicles.Filter()

// move selected rows from Filter to Delete Buffer
dw_vehicles.RowsMove(1,dw_vehicles_noowner.FilteredCount(), Filter!,dw_vehicles_noowner,1,Delete!)

// clear filter
dw_vehicles.Setfilter("")
dw_vehicles.Filter()

Comments