xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

GO

Moves the record pointer to a specified position.

Syntax

GO[TO] <nRecno> | BOTTOM | TOP

Arguments

<nRecno>
This is a numeric expression indentifying the record number to move the record pointer to.
BOTTOM
This option positions the record pointer on the last logical record.
TOP
This option positions the record pointer on the first logical record.

Description

The GO[TO] command positions the record pointer in the current work area to the specified position. The TOP and BOTTOM positions refer to the first and last logical records, while a numeric record number identifies a physical record.

If <nRecno> is smaller than 1 or larger than Lastrec(), the record pointer is positioned on the ghost record located at position Lastrec()+1.

Note:  Logical conditions restricting visibility of records, like SET DELETED, SET FILTER or SET SCOPE, are only taken into account with the TOP and BOTTOM options of the GO command. Positioning the record pointer to a physical record number ignores such conditions.

Info

See also:Bof(), DbGoto(), Eof(), LastRec(), RecNo(), SET DELETED, SET FILTER, SET RELATION, SET SCOPE, SKIP
Category: Database commands
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates logical and physical positioning of the
// record pointer.

   PROCEDURE Main
      USE Customer
      DELETE
      ? Recno(), Deleted()             // result: 1  .T.

      SET DELETED ON
      GO TOP                           // Logical positioning
      ? Recno(), Deleted()             // result: 2  .F.

      GOTO 1                           // Physical positioning
      ? Recno(), Deleted()             // result: 1  .T.

      USE
   RETURN

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