BuildInternalIndex()

Summary

Builds a permanent index on a field in a table.

Syntax

BuildInternalIndex(string field_spec)

Argument Contents
field_spec The field spec of the field to be indexed

Notes

  • An internal index is used for sorting and searching in the indexed field.

  • Works on dBASE, fixed-format text, fixed-format binary, and comma-separated text tables.

  • If an index file for this table already exists, it is modified. Otherwise a new index file is created.

  • Index files have these extensions:

File Type Extension
dBASE MDX (default) or .CDX (FoxPro-styled)
fixed-format text AX
fixed-format binary BX
comma-separated text CSX
  • BuildInternalIndex() fails if the program cannot obtain exclusive read-write permissions to the data and index files. This happens, for example, when the file is read-only, or opened by another user or application.

  • An internal index cannot contain an expression field.

  • If an internal index for this field already exists, BuildInternalIndex() signals an error.

Example

BuildInternalIndex("[U.S. States].Population")
BuildInternalIndex("Employee.LNAME")

Error Codes

Error Type Meaning
Error The program cannot create a new index file or cannot obtain exclusive read-write permissions to the index and data files;or the underlying index file structure does not support such an index (e.g., dBASE cannot index a logical field); or the specified index exists already; or there are file I/O errors (e.g., out of disk space).
NotFound The specified field does not exist