xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdNumber()

Returns the ordinal position of an open index by its symbolic name.

Syntax

OrdNumber( [<cIndexName>][, <cIndexFile>] ) --> nOrder

Arguments

<cIndexName>
This is a character string holding the symbolic name of the index whose ordinal position is searched. It is analogous to the alias name of a work area. Support for <cIndexName> depends on the RDD used to create the index. Usually, RDDs that are able to maintain multiple indexes in one index file support symbolic index names, such as DBFCDX, for example.
<cIndexFile>
<cIndexFile> is a character string with the name of the file that stores the index. It is only required when multiple index files are open that contain indexes having the same symbolic name.

Return

The function returns a numeric value specifying the ordinal position of the index <cIndexName>. Indexes are numbered in the sequence of opening, beginning with 1. If no parameter is passed, the ordinal position of the controlling index is returned. If no index is open, or if the name <cIndexName> does not exist, the return value is zero.

Description

OrdNumber() returns the ordinal position of an index based on its symbolic name. The name is specified with the TAG option of the INDEX command when the index is created. The reverse function of OrdNumber() is OrdName() which returns the symbolic name of an open index by its ordinal position.

Info

See also:Alias(), INDEX, OrdFor(), OrdKey(), OrdName()
Category: Database functions , Index functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example creates two indexes in one index file and displays.
// various information about the indexes.

   REQUEST Dbfcdx

   PROCEDURE Main
      USE Customer VIA "DBFCDX"
      ? OrdNumber()               // result: 0

      INDEX ON Upper(LastName+FirstName) TAG NAME  TO Cust01
      INDEX ON CustID                    TAG ID    TO Cust01

      ? OrdNumber()               // result: 2
      ? OrdKey()                  // result: CustID

      ? OrdNumber( "NAME" )       // result: 1
      ? OrdKey( "NAME" )          // result: Upper(LastName+FirstName)

      USE
   RETURN

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