Partager via


Index File Creation

As you created the first index key for your table in the topic Creating One Index, Visual FoxPro automatically created a new file, Customer.cdx, to store the new index key. The .cdx index file, called a structural compound index, is the most common and important type of index file you'll create in Visual FoxPro. The structural .cdx file:

  • Opens automatically when you open a table.
  • Can contain multiple ordering scenarios, or index keys, in the same index file.
  • Is automatically maintained as you add, change, or delete table records.

If a Visual FoxPro table has any index file associated with it at all, it is typically a structural .cdx file. The term "structural" refers to the fact that Visual FoxPro treats the file as an intrinsic part of the table and opens it automatically when you use a table. Whether you use the Table Designer or the simplest form of the INDEX command, as shown in the previous example, Visual FoxPro creates the .cdx file with the same base name as the current table, and stores the index information for the new key, or tag, inside. You use the structural .cdx file for frequently used index keys, such as those used for ordering records for daily viewing, data entry, SET RELATION linkages, Rushmore™ optimization on viewing records, or frequently printed reports.

Visual FoxPro offers you two additional types of index files: the non-structural .cdx file and the single-key .idx file. Because the .cdx (or structural compound compact index) is the most important index type, most of the examples in related topics will discuss using index keys in the .cdx file to order table records. The other two index file types are less frequently used and are discussed at the end of this section.

See Also

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