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: 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. Use the query object handle's
QUERY-OFF-END attribute to avoid a run-time search.
Example
The
following example uses the QUERY-OFF-END function to determine when
to leave the REPEAT loop:
r-qoff.p
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.