Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
Reality V15.0 ()
Using Indexes (DataBasic) (m618702+usingindexes.htm)
Indexes on a file are set up by using the TCL commands DEFINE-INDEX and CREATE-INDEX in turn. The definition of an index is based on English select and/or selection criteria. Other associated TCL commands are DELETE-INDEX, SELECT-INDEX and VERIFY-INDEX. For more details of these, and for general information about file indexing and its advantages, refer to the User's Reference: General.
An index containing all items in a file (one defined using sort criteria but without selection criteria) is used automatically when suitable English commands are executed (at TCL or via PERFORM or from a Proc). See User's Reference: Generalfor more details.
To use an index directly from DataBasic, you first OPEN the file on which the index is based in the usual way. Then use SELECT to attach a variable to the index.
You can then use READNEXT, READPREV, and POSITION statements (respectively) to read the next item-id, read the previous item-id, or re-position the index pointer. You can also also read the key value associated with the item-id from the index. This consists of the current values within the item of any attributes comprising the selection criteria used to define the index.