xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

SKIP

Moves the record pointer to a new position.

Syntax

SKIP [<nRecords>] [ALIAS <cAlias> | <nWorkArea>]

Arguments

<nRecords>
This is a numeric expression specifying the number of records to move the record pointer from its current position. Positive values for <nRecords> move the record pointer downwards and negative values move it upwards.

When no argument is passed, <nRecords> defaults to 1.

ALIAS <cAlias> | <nWorkArea>
The ALIAS option specifies the work area in which to move the record pointer. It can be specified as a symbolic alias name or as the numeric work area number.

Description

The SKIP command moves the record pointer of a work area to a new position. The new position is specified as a "distance" from the current record pointer, i.e. in number of records. A negative "distance" moves the record pointer towards the begin-of-file while positive value for <nRecords> moves it towards the end-of-file. A SKIP command issued with no value for <nRecords> advances the record pointer to the next record towards the end.

SKIP performs a logical navigation of the record pointer. That is, it navigates database records according to the controlling index, active filters and scopes (see INDEX, SET FILTER and SET SCOPE). A physical navigation is performed when no index and filter is active. In this case, SKIP navigates the record pointer in the order how records are stored in a database.

The command allows for navigating the record pointer of work areas other than the current work area by using the ALIAS option.

The record pointer cannot be moved outside physical or logical boundaries. Both are reached with GO TOP or GO BOTTOM.

When SKIP moves the record pointer using a negative distance and reaches the TOP, the record pointer remains on TOP and function BoF() returns .T. (true).

When SKIP moves the record pointer using a positive value for <nRecords> that goes beyond BOTTOM, the record pointer is positioned on the ghost record (Lastrec()+1) and function EoF() returns .T. (true).

Networking:  Use SKIP 0 to make changes to a record visible to other work stations while a record is locked.

Info

See also:Bof(), COMMIT, DbSkip(), Eof(), GO, LOCATE, RecNo(), SEEK
Category: Database commands
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The the example demonstrates the effect of SKIP

   PROCEDURE Main
      USE Customer

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

      SKIP 200
      ? RecNo()                        // result: 201

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

      GO BOTTOM
      SKIP 10
      ? RecNo()                        // result: 1996
      ? Eof()                          // result: .T.

      CLOSE Customer
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe