Move the record pointer to a new position
SKIP [<nRecords>] [ALIAS <idAlias> | <nWorkArea>]
<nRecords> is a numeric expression specifying the number of records to move the record pointer from the current position. A positive value moves the record pointer forward and a negative value moves the record pointer backward.
ALIAS <idAlias>|<nWorkArea> specifies the alias name as a literal identifier or the work area as a numeric expression.
SKIP specified with no arguments moves the record pointer forward one record.
SKIP moves the record pointer to a new position relative to the current position in the current work area and within the current filter, if there is one. SKIP is generally used for operations, such as reporting, that need to go to the next record in a database file.
If the alias clause is specified, the pointer can be moved in another work area without SELECTing that work area. SKIP can move either forward or backward. If there is no active index, SKIP moves the record pointer relative to the current position in the target database file. If there is an active index, SKIP moves the pointer relative to the current position in the index instead of the database file.
Attempting to SKIP forward beyond the end of file positions the record pointer at LASTREC() + 1, and EOF() returns true (.T.). Attempting to SKIP backward beyond the beginning of file moves the pointer to the first record, and BOF() returns true (.T.).
In a network environment, any record movement command, including SKIP, makes changes to the current work area visible to other applications if the current file is shared and the changes were made during an RLOCK(). To force an update to become visible without changing the current record position, use SKIP 0. If, however, the changes were made during an FLOCK(), visibility is not guaranteed until the lock is released, a COMMIT is performed, or the file is closed. Refer to the “Network Programming” chapter for more information.
. This example uses SKIP with various arguments and shows their results: USE Customers NEW SKIP ? RECNO() // Result: 2 SKIP 10 ? RECNO() // Result: 12 SKIP -5 ? RECNO() // Result: 7 . This example moves the record pointer in a remote work area: USE Customers NEW USE Invoices NEW SKIP ALIAS Customers . This example prints a report using SKIP to move the record pointer sequentially through the Customer database file: LOCAL nLine := 99 USE Customers NEW SET PRINTER ON DO WHILE !EOF() IF nLine > 55 EJECT nLine := 1 ENDIF ? Customer, Address, City, State, Zip nLine++ SKIP ENDDO SET PRINTER OFF CLOSE Customers
BOF(), COMMIT, DBSKIP(), EOF(), GO, LOCATE, RECNO(), SEEK