xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

IndexOrd()

Returns the ordinal position of the controlling index in a work area.

Syntax

IndexOrd() --> nOrder

Return

The function returns the ordinal position of the controlling index as a numeric value. If no index or database is open in the work area, the return value is zero.

Description

The function is used to retrieve the ordinal position of the controlling index in the list of open indexes. Indexes are numbered in the sequence of opening, beginning with 1.

IndexOrd() is mainly used to save the position of the controlling index, temporarily change the controlling index, and restore it using DbSetOrder() or OrdSetFocus() when a database operation is complete.

Info

See also:INDEX, DbSetOrder(), IndexKey(), OrdKey(), OrdListAdd(), OrdNumber(), OrdSetFocus(), SET INDEX, SET ORDER, USE
Category: Database functions , Index functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example illustrates return values of IndexOrd().

   REQUEST DBFCDX

   PROCEDURE Main
      RddSetDefault( "DBFCDX" )
      USE Customer

      INDEX ON CustNO                     TAG ID   TO Cust01
      INDEX ON Upper(LastName+Firstname)  TAG Name TO Cust01

      ? IndexOrd()               // result: 2
      ? IndexKey(0)              // result: Upper(LASTNAME+FIRSTNAME)

      DbSetOrder(1)

      ? IndexOrd()               // result: 1
      ? IndexKey(0)              // result: CustID

      USE
   RETURN

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