xHarbour Reference Documentation > Command Reference |
Moves the record pointer to a new position.
SKIP [<nRecords>] [ALIAS <cAlias> | <nWorkArea>]
When no argument is passed, <nRecords> defaults to 1.
The SKIP command moves the record pointer of a work area to a new position. The new position is specified as a "distance" from the current record pointer, i.e. in number of records. A negative "distance" moves the record pointer towards the begin-of-file while positive value for <nRecords> moves it towards the end-of-file. A SKIP command issued with no value for <nRecords> advances the record pointer to the next record towards the end.
SKIP performs a logical navigation of the record pointer. That is, it navigates database records according to the controlling index, active filters and scopes (see INDEX, SET FILTER and SET SCOPE). A physical navigation is performed when no index and filter is active. In this case, SKIP navigates the record pointer in the order how records are stored in a database.
The command allows for navigating the record pointer of work areas other than the current work area by using the ALIAS option.
The record pointer cannot be moved outside physical or logical boundaries. Both are reached with GO TOP or GO BOTTOM.
When SKIP moves the record pointer using a negative distance and reaches the TOP, the record pointer remains on TOP and function BoF() returns .T. (true).
When SKIP moves the record pointer using a positive value for <nRecords> that goes beyond BOTTOM, the record pointer is positioned on the ghost record (Lastrec()+1) and function EoF() returns .T. (true).
Networking: Use SKIP 0 to make changes to a record visible to other work stations while a record is locked.
See also: | Bof(), COMMIT, DbSkip(), Eof(), GO, LOCATE, RecNo(), SEEK |
Category: | Database commands |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The the example demonstrates the effect of SKIP PROCEDURE Main USE Customer ? LastRec() // result: 1995 ? RecNo() // result: 1 SKIP 200 ? RecNo() // result: 201 SKIP -500 ? RecNo() // result: 1 ? Bof() // result: .T. GO BOTTOM SKIP 10 ? RecNo() // result: 1996 ? Eof() // result: .T. CLOSE Customer RETURN
http://www.xHarbour.com