Function OrdListAdd() Foundation
Activate one or more indexes in a work area.
OrdListAdd( <cIndexFile> [,<cTagName>] ) --> NIL
The return value of OrdListAdd() is always NIL.
The index function OrdListAdd() activates one or more indexes from an index file in a work area. When the function is used without the alias operator, the index file is opened in the current work area and the indexes from the index file become active in this area. If no index file is open in the work area, OrdListAdd() sets the controlling index for the DBF file in the work area. When index files are already open, the controlling index remains unchanged. The data record pointer is always positioned to the first logical data record of the controlling index after the call to OrdListAdd().
The number of indexes that can be managed within an index file depends on the active database engine (DBE). The DBFNTX DBE supports only one index per index file.
When an index file is active, the data records of the DBF file in the work area are logically sorted into the order predetermined by the index.
// In the example, two index files for a customer file are created
// and then closed. The effect of the function OrdListAdd() is
// shown.
PROCEDURE Main
USE Customer NEW EXCLUSIVE
INDEX ON CUSTNO ;
TAG C_Number ;
TO CustA
INDEX ON Upper(LASTNAME+FIRSTNAME) ;
TAG C_LastName ;
TO CustB
OrdListClear()
DbGoTop()
// ** No index
? RecNo() // result: 1
? OrdKey() // result: null string ("")
? LastName // result: King
OrdListAdd("CustB") // ** CustB becomes controlling
// ** index, record pointer changes
? RecNo() // result: 13
? OrdKey(OrdNumber()) // result: Upper(LASTNAME+FIRSTNAME)
? LastName // result: Anderson
SKIP 20
? RecNo() // result: 21
? LastName // result: Lammers
OrdListAdd("CustA") // ** CustA is opened,
// ** controlling index remains
// ** record pointer changes
? RecNo() // result: 13
? OrdKey(OrdNumber()) // result: Upper(LASTNAME+FIRSTNAME)
? LastName // result: Anderson
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.