INDEX

This command is used to INDEX files, i.e. to arrange them in a specified (numeric or alphabetical) order. The Index command creates the so called index files, which are stored on disk with the extension .ntx.

Suppose you have a aand.dbf with the field AVA containing Avar words and you want to arrange them in alphabetical order. Open aand.dbf using the File menu. Then choose the Index option of the Assist menu. You will be asked:

Index file name:
Enter any name you like (just as long it consists of Latin characters and contains no inside blanks - these are usual requirements to any filename), e.g. ava. Next you will be asked:
Key expression:
This must be the expression on which you index the file. In most cases you can just enter a fieldname - in our case AVA - and a requested index file will be created. If afterwards you will BROWSE, EDIT or LIST the aand.dbf with the AVA index (which is stored on disk as ava.ntx) the whole file will be arranged according to the alphabetical order of the AVA field. (Note that there is nothing changed in the original file - if you use it without the .ntx file, it will be exactly the same as it had been).

To switch between different indexes you may use the Ctrl D key combination while editing your files. Star4Win will prompt you with a menu of existing index files from which you can choose. By default you will be proposed to use an index file whose name corresponds to the name of your database (truncated to six characters) + the number of the field you are currently editing. If such an index exists it will be used, but you will be preliminarily asked whether you wish to update it or not (index information may be outdated if you have modified your database without this index file previously). If it does not exist it will be automatically created using the current alphabet order provided in the ORDER line of config.str.

To turn the index off and restore the physical order of records you have to press Ctrl D for the second time.

You may enter more complicated expressions as index keys. For example, you may want to index your file according to the inverse order of entries in the AVA field (to make an inverse dictionary). In this case you will want the file indexed on reverted Avar words. Since these words are of different length, the whole expression will look rather complicated:

reverse(Trim(AVA)))
Use the information about functions contained in this file to formulate any expressions valid for indexing.