xHarbour Reference Documentation > Function Reference |
Returns the index expression of an open index.
IndexKey( <nOrder> ) --> cIndexKey
The function returns the index key expression of the specified index as a character string. If the work area is unused, an empty string ("") is returned.
The function is used to obtain the index key expression of an index open in a work area. The returned character string can be evaluated using the macro operator (&) to obtain the index value of the current database record. This is useful, for example, when data is edited by the user and written back to the database file. If this operation changes the index value of the controlling index, a screen update may be required, especially in browse views.
Note: The function exists for compatibility reasons. It is recommended to use OrdKey() instead.
See also: | INDEX, IndexExt(), IndexOrd(), OrdCreate(), OrdKey(), OrdListAdd(), OrdNumber(), SET INDEX, SET ORDER, USE |
Category: | Database functions , Index functions |
Source: | rdd\rddord.prg |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example creates two indexes and displays their // key expressions. REQUEST DBFCDX PROCEDURE Main RddSetDefault( "DBFCDX" ) USE Customer INDEX ON CustID TAG ID TO Cust01 INDEX ON Upper(LastName+FirstName) TAG Name TO Cust01 ? IndexOrd() // result: 2 ? IndexKey(0) // result: Upper(LastName+FirstName) ? IndexKey(1) // result: CustID ? IndexKey(2) // result: Upper(LastName+FirstName) USE RETURN
http://www.xHarbour.com