Share via


Index Information Display

You can see how many records are indexed during the indexing process by setting TALK to ON. The record interval displayed during indexing can be specified with SET ODOMETER COMMAND. For more information about open index files, use the DISPLAY STATUS Command. This command lists the names of all open index files, their types (structural, .cdx, .idx), their index expressions, and the name of the master index file or master tag.

Only the supply of memory and system resources can limit the number of index files (.idx or .cdx) you can open.

Controlling Duplicate Values

Visual FoxPro supports four types of indexes: primary, candidate, unique, and regular. These index types control whether duplicate values are permitted or prohibited in table fields and records.

Preventing Duplicate Values

A primary index is an index that never permits duplicate values on the specified fields or expression. Primary indexes are principally used within the primary or "referenced" table for establishing referential integrity in a persistent relationship. You can create only one primary index for a table. Visual FoxPro returns an error if you specify a primary index on any field that already contains duplicate data.

A candidate index is an index that never permits duplicate values on the specified fields or expression. The name "Candidate" refers to the status of the index; since candidate indexes prohibit duplicate values, they qualify as "candidates" to be selected as the primary index on a table. You can create multiple candidate indexes for a table. You use candidate indexes as either the referenced or referencing index in a persistent relationship for establishing referential integrity. Visual FoxPro returns an error if you specify a candidate index on any field that already contains duplicate data.

For compatibility with previous versions, you can also create a unique index that selects and orders a subset of records based on the first occurrence of a value in the field you specify. If you want to select records this way, you might want to create a query or view instead.

A regular index determines the order in which a record is processed but allows duplicate values to be entered into a field. You can add more than one regular index to a table.

See Also

Index File Creation | Setting a Primary or Candidate Index | Working with Records | Index Creation for Tables | Permitting Duplicate Values | Creating Multiple Indexes | Ordering by Multiple Fields