INDEXORD() Return the order position of the controlling index ------------------------------------------------------------------------------ Syntax INDEXORD() --> nOrder Returns INDEXORD() returns an integer numeric value. The value returned is equal to the position of the controlling index in the list of open indexes for the current work area. A value of zero indicates that there is no controlling index and records are being accessed in natural order. If no database file is open, INDEXORD() will also return a zero. Description INDEXORD() is a database function that determines the position of the controlling index in the list of index files opened by the last USE...INDEX or SET INDEX TO in the current work area. It is often useful to save the last controlling index so it can be restored later. By default, INDEXORD() operates on the currently selected work area. It will operate on an unselected work area if you specify it as part of an aliased expression (see example below). Examples . This example uses INDEXORD() to save the current order. After changing to a new order, it uses the saved value to restore the original order: USE Customer INDEX Name, Serial NEW nOrder := INDEXORD() // Result: 1 SET ORDER TO 2 ? INDEXORD() // Result: 2 SET ORDER TO nOrder ? INDEXORD() // Result: 1 . This example uses an aliased expression to determine the order number of the controlling index in an unselected work area: USE Sales INDEX Salesman, CustNum NEW USE Customer INDEX Name, Serial NEW ? Sales->(INDEXORD()) // Result: 1 Files Library is CLIPPER.LIB.
See Also: INDEX INDEXKEY() SET INDEX SET ORDER USE
Pingback: C5_SET ORDER | Viva Clipper !