xHarbour Reference Documentation > Command Reference |
Changes the top and/or bottom scope for navigating in the controlling index.
SET SCOPE TO [<topScope> [, <bottomScope>]]
If <bottomScope> is omitted and <topScope> is defined, it is used for both, the top and bottom scope.
SET SCOPE TO with no argument clears a defined scope.
The SET SCOPE command defines or clears the top and bottom scope for indexed database navigation. The top and bottom scope values define the range of values valid for navigating the record pointer within the controlling index.
When a scope is set, the GO TOP command is equivalent to SEEK <topScope>, while GO BOTTOM is the same as SEEK <bottomScope> LAST.
Attempting to move the record pointer before <topScope> does not change the record pointer but causes function BoF() to return .T. (true).
When the record pointer is moved beyond <bottomScope>, it is advanced to the ghost record (Lastrec()+1) and function EoF() returns .T. (true).
See also: | BoF(), EoF(), Found(), GO, OrdKey(), OrdScope(), SET INDEX, SET ORDER, SKIP |
Category: | Database commands , Index commands |
Header: | Ord.ch |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates indexed database navigation // restricted by scopes. #include "Ord.ch" PROCEDURE Main USE Customer INDEX ON Upper(LastName) TO Cust01 GO TOP ? Recno(), Bof(), Eof(), Lastname // result: 25 .F. .F. Abbey GO BOTTOM ? Recno(), Bof(), Eof(), Lastname // result: 127 .F. .F. Zwillick SET SCOPE TO "E", "G" GO TOP ? Recno(), Bof(), Eof(), Lastname // result: 558 .F. .F. Earley SKIP -1 ? Recno(), Bof(), Eof(), Lastname // result: 558 .T. .F. Earley GO BOTTOM ? Recno(), Bof(), Eof(), Lastname // result: 1660 .F. .F. Gwinnell SKIP ? Recno(), Bof(), Eof(), Lastname // result: 1996 .F. .T. RETURN
http://www.xHarbour.com