PowerBuilder ‘Gotcha’ – Datawindow Find method

Posted on Friday, August 6th, 2010 at 8:20 pm in

The find method on the datawindow is a very useful tool but you should always remember to set the upper limit of the rows to search in excess of the actual rowcount. In simple terms:

dw_1.find('part_no = 123', 1, dw_1.rowcount())

Never do this!
Instead use:

dw_1.find('part_no = 123', 1, dw_1.rowcount() + 1)

or simply

dw_1.find('part_no = 123', 1, 99999 )

This option only if you know 99999 will always be larger than the number of rows.

Why? It is possible to fall into an endless loop when the find hits the limit of the datawindow rows.

You might also be interested in