xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdKeyGoTo()

Moves the record pointer to a logical record number.

Syntax

OrdKeyGoTo( <nIndexKeyNo> ) --> lSuccess

Arguments

<nIndexKeyNo>
This is a numeric value specifying the logical record number to move the record pointer to. Logical record numbers are in the range of 1 to OrdKeyCount() and depend on the controlling index.

Return

The function returns .T. (true) if the record pointer is successfully positioned on the specified logical record number, otherwise .F. (false) is returned.

Description

The function OrdKeyGoTo() moves the record pointer based on its logical record number, which can be retrieved using function OrdKeyNo().

The logical record number represents the position of a record in the controlling index, while the physical record number Recno() represents a record's position in the database. Physical record movement is accomplished using function DbGoTo().

Info

See also:DbOrderInfo(), DbGoto(), LastRec(), OrdFindRec(), OrdKeyNo(), OrdKeyRelPos(), OrdKeyCount(), RecNo()
Category: Database functions , Index functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines the difference between physical and logical
// record pointer movement.

   REQUEST Dbfcdx

   PROCEDURE Main
      USE Customer VIA "DBFCDX"
      INDEX ON Upper(LastName) TAG NAME TO Cust01

      DbGoto( 1 )                        // Physical first record
      ? Lastname, Recno(), OrdKeyNo()    // result: Miller    1  15

      DbGoto( LastRec() )                // Physical last record
      ? Lastname, Recno(), OrdKeyNo()    // result: Smith    22  19

      OrdKeyGoto( 1 )                    // Logical first record
      ? Lastname, Recno(), OrdKeyNo()    // result: Alberts  20   1

      OrdKeyGoto( OrdKeyCount() )        // Logical last record
      ? Lastname, Recno(), OrdKeyNo()    // result: Waters   15  22

      USE
   RETURN

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