Previous Next

QUERY-OFF-END function
Returns a LOGICAL value indicating whether the specified query is positioned at the end of its result list (either before the first record or after the last record).
Syntax 
 
QUERY-OFF-END ( query-name )
query-name
A character expression that evaluates to the name of a currently open query. If query-name does not resolve to the name of a query, or if the query is not open, then the function returns the Unknown value (?).
Note:
Example 
The following example uses the QUERY-OFF-END function to determine when to leave the REPEAT loop:
 
OPEN QUERY cust-query FOR EACH Customer.
 
REPEAT:
  GET NEXT cust-query.
  IF QUERY-OFF-END("cust-query") THEN LEAVE.
  DISPLAY Customer.CustNum Customer.Name.
END.
When you run this procedure, all Customer numbers and names are displayed. After the last record is displayed, the loop iterates and the GET NEXT statement reads beyond the last record. At this point QUERY-OFF-END returns TRUE and the AVM exits the loop.
Note 
To test whether a GET statement read beyond the last (or first) record, you can use the AVAILABLE function with the buffer name. You can also use the QUERY-OFF-END function, which serves the same purpose, but does not require a specific buffer; it requires only a query name.
See also 
CLOSE QUERY statement, CURRENT-RESULT-ROW function, DEFINE BROWSE statement, DEFINE QUERY statement, GET statement, NUM-RESULTS function, OPEN QUERY statement, QUERY-OFF-END attribute, REPOSITION statement

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.