Try OpenEdge Now
skip to main content
ABL Essentials
Using Queries : Defining and using queries : Repositioning a query
 

Repositioning a query

Often you need to reposition a query other than to the first, last, next, or previous row. You might need to jump to a row based on data the user entered or return to a row that you previously saved off. Or you might want to jump forward or backward a specific number of rows to simulate paging through the query. You can do all these things with the REPOSITION statement, which has this syntax:

Syntax

REPOSITION query-name
  {|TO ROW row-number
     |FORWARDS n
     |BACKWARDS n
     |TO ROWID buffer-1-rowid[, . . .][ NO-ERROR ]  }
The query-name in this case is not an expression. It can only be an unquoted query name, not a variable.
If you specify the TO ROW option followed by an integer expression, the query repositions to that sequential position within the results list. If you have previously saved off that position using the CURRENT-RESULT-ROW function, you can use the value that function returned as the value in the TO ROW phrase to reposition to that row.
If you use the FORWARDS or BACKWARDS phrase, you can jump forward or backward any number of rows, specified by the n integer expression. You can use the FORWARD or BACKWARD keywords instead of FORWARDS or BACKWARDS.
The last of the REPOSITION options requires an explanation of an ABL data construct you haven't seen before.
* Using a RowID to identify a record
* Positioning details with the REPOSITION statement