Commands and Statements

Command SKIP Foundation

Positions the record pointer relative to the current record.

SKIP [<nRecords>] [ALIAS <cAlias> | <nWorkArea>]
SKIP [<nRecords>] [IN <cAlias> | <nWorkArea>]
<nRecords> is an integer specifying the number of records by which the record pointer is moved. If <nRecords> is less than zero, the record pointer is moved backward, otherwise it is moved forward. The default value for <nRecords> is 1. Movement using this command is done on the basis of logical records.
<cAlias> is either a literal alias name or a character expression in parentheses containing the alias name for the work area whose record pointer is to be moved.
<nWorkArea> can be specified as an alternative to <cAlias>. It is a positive integer indicating the ordinal number of the work area whose record pointer is moved. The argument can appear as a literal or as a numeric expression in parentheses.

The file command SKIP moves the record pointer in a work area by <nRecords> records. When the command is used without the ALIAS option, SKIP positions the record pointer in the current work area.

If an attempt is made to position the record pointer in front of the first record, it is set to the first record and the function Bof() returns the value .T. (true). When the record pointer is positioned after the last record, it is set to the "Phantom" data record (for DBF files, it corresponds to the record pointer position LastRec()+1) and the function Eof() returns the value .T. (true).

SKIP moves the record pointer on the basis of the logical records in the work area. When an index and/or a filter condition is active, sorting and filtering are considered.

The functional equivalent of the command SKIP is the function DbSkip().

// In the example, the effect of SKIP is displayed 

   USE Customer NEW 

   ? RecNo()               // result: 1 
   ? LastRec()             // result: 100 

   ? RecNo()               // result: 2 

   SKIP 20 
   ? RecNo()               // result: 22 

   SKIP -5 
   ? RecNo()               // result: 17 

   SKIP -20 
   ? RecNo()               // result: 1 
   ? Bof()                 // result: .T. 

   SKIP 1000 
   ? RecNo()               // result: 101 
   ? Eof()                 // result: .T. 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.