Function DbSkip() Foundation

Positions the record pointer relative to the current record.

Syntax
DbSkip( [<nRecords>] ) --> NIL
Parameters
<nRecords>
<nRecords> is an integer specifying the number of records to move the record pointer. If <nRecords> is less than zero, the record pointer is moved backwards, otherwise it is moved forward. The default value for <nRecords> is 1. The function works on the basis of logical records.
Return

The return value of DbSkip() is always NIL.

Description

The database function DbSkip() moves the record pointer in a work area by <nRecords> records. If the function is used without the alias operator, DbSkip() repositions the record pointer in the current work area.

If an attempt is made to move 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). If an attempt is made to position the record pointer beyond the last record, it is set on the "phantom" record and the function Eof() returns the value .T. (true) (for DBF files this corresponds with the record pointer position LastRec()+1).

DbSkip() moves the record pointer on the basis of the logical data records in a work area. When an index and/or filter condition is active, logical order and filter conditions are considered.

The command SKIP can be used instead of DbSkip(). SKIP is effective only in the current work area.

If <nRecords> is 0, DbSkip() attempts to reload the current record, furthermore current filter/scope and deleted conditions are evaluated. If the current record no longer is visible, DbSkip() moves the record pointer to the next visible record. This behaviour is different from Clipper's.

Examples
DbSkip()
// In the example, the effect of DbSkip() is illustrated 

PROCEDURE Main 
   USE Customer NEW 

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

   DbSkip() 
   ? RecNo()               // result: 2 

   DbSkip(20) 
   ? RecNo()               // result: 22 

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

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

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

   USE 
RETURN 

Filter condition with DbSeek() and DbSkip()

// In this example, the addresses for all customers 
// with the name "Miller" are listed. Instead of using 
// DbSetFilter(), the filter effect is accomplished 
// faster using faster DbSeek() and then DbSkip() called 
// in a DO WHILE loop. 

PROCEDURE Main 
   LOCAL cLastName := "MILLER" 

   USE Customer NEW EXCLUSIVE 
   INDEX ON Upper(LastName+FirstName) TO CustA 
   DbSeek( cLastName ) 

   DO WHILE cLastName == Trim(Upper(Customer->LastName)) 
      ? FirstName, LastName 
      ? Street 
      ? City + ",", State, Zip 
      ? 
      DbSkip() 
   ENDDO 

   CLOSE Customer 

RETURN 

Feedback

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.