Using the QUERY-OFF-END function
- Last Updated: October 18, 2024
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Using the QUERY-OFF-END function
There is a built-in ABL function that you can use for
the same purpose as the AVAILABLE statement:
|
QUERY-OFF-END is a logical function that returns TRUE if
the query is positioned either before the first result set row or
after the last row, and FALSE if it is positioned directly
on any row in the result set. The query-name parameter
must be either a quoted literal string with the name of the query
or a variable name that has been set to the name of the query. In
this way, you can use the statement programmatically to test potentially
multiple different active queries in your procedure.
For example, here is the same procedure used previously, this
time with the QUERY-OFF-END function in place of AVAILABLE:
|
The difference between QUERY-OFF-END and AVAILABLE is
simply that AVAILABLE requires a buffer name as
a parameter, whereas QUERY-OFF-END requires a query
name. If you use the AVAILABLE function with the
name of the first buffer in the query, it is equivalent to using QUERY-OFF-END with
the query name. Just for stylistic reasons, it is more appropriate
to use the QUERY-OFF-END function in most cases,
since it is the position of the query and not the presence of a
record in a particular buffer that you're really interested in.
By contrast, if you really want to test for the presence of a record,
especially when your query does an outer join that might not always retrieve
a record into every buffer, then use the AVAILABLE function.