xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdName()

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

Syntax

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

Arguments

<nOrder>
A numeric value specifying the ordinal position of the index open in a work area. Indexes are numbered in the sequence of opening, beginning with 1. The value zero identifies the controlling index. The default value is 0.
<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 name.

Return

The function returns the index name at position <nOrder> in the list of open indexes as a character string. If no parameters are passed, the index name of the controlling index is returned. If no index is open, the return value is an empty string ("").

Description

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

Info

See also:Alias(), INDEX, OrdFor(), OrdKey(), OrdNumber()
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 open indexes.

   REQUEST Dbfcdx

   PROCEDURE Main
      USE Customer VIA "DBFCDX"

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

      ? OrdName()                 // result: ID
      ? OrdKey()                  // result: CustID

      ? OrdSetfocus( "NAME" )     // result: ID
      ? OrdName()                 // result: NAME
      ? OrdKey()                  // result: Upper(LastName+FirstName)

      ? OrdName(1)                // result: NAME
      ? OrdName(2)                // result: ID
      USE
   RETURN

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