Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : CURRENT-RESULT-ROW function


Returns the number of the current row of a specified query as an INTEGER value.


CURRENT-RESULT-ROW ( query-name )
A character expression that evaluates to the name of a currently open, scrolling query. If query-name does not resolve to the name of a query, or if the query is not open or not scrolling, then the function returns the Unknown value (?).
Note: Searching for a query using a handle is more efficient than a character expression. The AVM resolves a character expression at run time by searching in the current routine for a static query with that name. If not found, the AVM searches the enclosing main procedure. If still not found, the AVM searches up through the calling programs of the current routine and their main procedures. Since a handle uniquely identifies a query, no such search is required.


The following example uses the QUERY-OFF-END function to determine when to leave the REPEAT loop:
OPEN QUERY cust-query FOR EACH Customer WHERE Customer.Country = "USA".

  GET NEXT cust-query.
  IF QUERY-OFF-END("cust-query") THEN LEAVE.
  DISPLAY CURRENT-RESULT-ROW("cust-query") LABEL "Result Row"
    Customer.CustNum Customer.Name.


*To use the CURRENT-RESULT-ROW function with a query, the query must be associated with a browse widget or you must define the query with the SCROLLING option. For more information on query definitions, see the reference entry for the DEFINE QUERY statement.
*If the query is empty, CURRENT-RESULT-ROW returns the Unknown value (?).
*If the query is positioned before the first record, CURRENT-RESULT-ROW returns the value 1. If the query is positioned beyond the last record, CURRENT-RESULT-ROW returns a value 1 greater than the number of rows in the query result list.
*When possible, the AVM performs optimizations for GET LAST and REPOSITION statements. These optimizations make the results list invalid. At that point, CURRENT-RESULT-ROW returns the Unknown value (?). These optimizations do not occur if the query is opened with the PRESELECT option or has an associated browse widget.

See also

CLOSE QUERY statement, CURRENT-REQUEST-INFO attribute, DEFINE BROWSE statement, DEFINE QUERY statement, GET statement, NUM-RESULTS function, OPEN QUERY statement, REPOSITION statement