If a DataWindow object retrieves hundreds of rows, there can be a noticeable delay at runtime while all the rows are retrieved and before control returns to the user. For these DataWindow objects, PowerBuilder can retrieve only as many rows as it has to before displaying data and returning control to the user.
For example, if a DataWindow object displays only 10 rows at a time, PowerBuilder only needs to retrieve 10 or more rows before presenting the data. Then, as the user pages through the data, PowerBuilder continues to retrieve what is necessary to display the new information. There may be slight pauses while PowerBuilder retrieves the additional rows, but these pauses are usually preferable to waiting a long time to start working with data.
To specify that a DataWindow object retrieve only as many rows as it needs to:
Select Rows>Retrieve Options>Rows As Needed from the menu bar.
With this setting, PowerBuilder presents data and returns control to the user when it has retrieved enough rows to display in the DataWindow object.
Retrieve Rows As Needed is overridden if you have specified sorting or have used aggregate functions, such as Avg and Sum, in the DataWindow object. This is because PowerBuilder must retrieve every row before it can sort or perform aggregates.
In a multiuser situation, Retrieve Rows As Needed might lock other people out of the tables.