Command SET ORDER Foundation
Specifies the controlling index in the current work area or the work area specified.
SET ORDER TO [<nIndex>] | TAG <cTagName>
[OF <cIndexfile>]
[IN <nWorkArea> | <cAlias> ]
[ASCENDING | descending]
SET ORDER determines the controlling index in the current work area. This index specifies the logical order of the records in the work area.
The value for <nIndex> must be between zero and the number of open index files in the work area. When the value is equal to zero, access to the records occurs in their natural order (with no logical sorting). However, the open index files continue to be updated. A value not equal to zero activates an index based on the order that the index files were opened in the work area.
// In the example, two index files are created for a
// customer file. The effect of the command SET
// ORDER is shown.
PROCEDURE Main
USE Customer NEW EXCLUSIVE
INDEX ON CustNo TO CustA
INDEX ON Upper(LName+FName) TO CustB
SET INDEX TO CustA, CustB
GO TOP // ** CustA is controlling
// ** index
? IndexKey(IndexOrd()) // result: CustNo
? LName // result: King
? CustNo // result: 1
SET ORDER TO 2 // ** CustB becomes controlling
GO TOP // ** index
? IndexKey(IndexOrd()) // result: Upper(LName+FName)
? LName // result: Anderson
? CustNo // result: 13
CLOSE Customer
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.