xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

OrdKey()

Returns the key expression of an index.

Syntax

OrdKey( [<nOrder>|<cIndexName>][,<cIndexFile>] ) --> cIndexKey

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.
<cIndexName>
Alternatively, a character string holding the symbolic name of the open index can be passed. It is analogous to the alias name of a work area. Support for <cIndexName> depends on the RDD used to open 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 <cIndexName>.

Return

The function returns the key expression of the specified index as a character string. If no parameters are passed, the index key of the controlling index is returned. If no index is open, the return value is an empty string ("").

Description

OrdKey() returns the index key expression of an index as a character string. It is similar to OrdFor() which returns the FOR expression of the index.

Info

See also:DbOrderInfo(), INDEX, IndexKey(), OrdCreate(), OrdFor(), OrdKeyCount(), OrdKeyNo(), OrdKeyVal(), OrdName(), OrdNumber()
Category: Database functions , Index functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example creates two indexes and displays their key expressions

   PROCEDURE Main
      USE Customer
      OrdCreate( "Customer1", "ID"  , "CUSTNO"  )
      OrdCreate( "Customer2", "NAME", "Upper(LastName+FirstName)" )

      OrdSetFocus( "ID" )

      ? OrdKey()                  // result: CUSTNO

      OrdSetfocus( "NAME" )

      ? OrdName()                 // result: NAME
      ? OrdNumber()               // result: 2
      ? OrdKey()                  // result: Upper(LastName+FirstName)

      ? OrdKey(1)                 // result: CUSTNO
      ? 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