xHarbour Reference Documentation > Function Reference |
Retrieves the index value of the current record from the controlling index.
OrdKeyVal() --> xIndexValue
The function returns the index value of the current record. The return value is NIL if the current record is not included in the controlling index or if there is no controlling index.
The function retrieves the index value for the current record from the index file holding the controlling index, not from the database file. This can be advantageous when an index expression is comprised of multiple fields. Their values can be assigned to a memory variable with one function call, rather than accessing multiple field variables individually.
See also: | DbOrderInfo(), INDEX, IndexKey(), OrdCreate(), OrdFor(), OrdKey(), OrdKeyNo(), OrdName(), OrdNumber() |
Category: | Database functions , Index functions |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example uses the index value to display Lastname and Firstname // instead of field variables. PROCEDURE Main LOCAL cName USE Customer INDEX ON Upper( LastName + FirstName ) TO Cust01 ? FieldPos( "FirstName" ) // result: 2 ? FieldPos( "MiddleName" ) // result: 3 ? FieldPos( "LastName" ) // result: 4 ? FieldLen( 2 ) // result: 20 ? FieldLen( 4 ) // result: 20 cName := OrdKeyVal() ? Trim( Right(cName, 20)), Trim( Left(cName,20) ) USE RETURN
http://www.xHarbour.com