|DBSkip -- Move the record pointer|
|Navigating the Database|
THIS FUNCTION HAS CHANGED IN FILEFLEX 3.0|
If you don't know the number of the record you want to access, but you know its position relative to the current one, use the DBSkip function. DBSkip is also subject to logical record order. If an index or relation is active, DBSkip will move the offset number of records according to the logical order of the database.
You can move the current database record pointer forward or backward a specified number of records with the FileFlex DBSkip function. You must supply an integer (positive or negative) describing the number of records to skip. A negative number tells FileFlex to move backward in the file. When it reaches the indicated record, FileFlex leaves the record pointer positioned at the record. You can then use the "DBGetCurrRecVa"l function to retrieve the fields in that record as desired.
put DBSkip(23) into skipResult put DBGetCurrRecVal("A") into dbResult
Here is how the function would normally be called if you want to skip 10 records from where you are currently positioned in the file:
put DBSkip(10) into dbResult
Or, for example, you may enter:
DBSkip(15) -- to skip forward fifteen records. DBSkip(-2) -- to skip backward two records.
The behavior of DBSkip depends on whether there is an index file open or whether a relational operation is currently active. If an index file is currently in use, DBSkip will skip the number of records in the sequence in which the index sorts the file. If a relational query function has been called with an argument other than an empty string, then DBSkip will skip records matching the search criteria defined in the relational query.
DBSkip will not allow backwards skips if an index is active. Doing so (passing, for example, a -1) will result in a general index error. To DBSkip backwards on indexes, create a descending order index tag.