Function DbSkip() Foundation
Positions the record pointer relative to the current record.
DbSkip( [<nRecords>] ) --> NIL
The return value of DbSkip() is always NIL.
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.
// 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
// 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
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.