CDX( ) Function

Example   See Also

Returns the names of the open compound index (.cdx) file that has the specified index position number.

Syntax

CDX(nIndexNumber [, nWorkArea | cTableAlias])

Returns

Character

Arguments

nIndexNumber

The following apply to a table with a structural compound index and one or more compound indexes:

nIndexNumber Description
1 Returns the name of the structural index file(which is always the same as the name of the table).
2 Returns the first compound index file name specified in the INDEX clause of USE or in SET INDEX.
3 Returns the second compound index file name, if any, and so on.
Greater than the number of open .cdx files Returns the empty string.

The following apply to a table with no structural compound index and one or more compound indexes:

nIndexNumber Description
1 Returns the first compound index file name specified in the INDEX clause of USE or in SET INDEX.
2 Returns the second compound index file name, if any, and so on.
Greater than the number of open .cdx files Returns the empty string.

nWorkArea

Specifies the work area number of a table whose open compound index file names you want CDX( ) to return.

cTableAlias

Specifies the alias of a table whose open compound index file names you want CDX( ) to return.

If you omit nWorkArea and cTableAlias, names of compound index files are returned for the table in the currently selected work area.

Remarks

The CDX( ) function is identical to the MDX( ) function.

A .cdx (compound) index consists of one physical file containing many index tags. Each index tag is an index order reference for the associated table.

There are two types of .cdx files: standard compound index (.cdx) and structural .cdx. A standard compound index (.cdx) may have a different name from its associated table and can reside in a different directory from its associated table. A table can have multiple compound index files. You open a compound index with the INDEX clause of USE or with SET INDEX.

A structural .cdx must have the same name as its associated table and reside in the same directory. A table can have only one structural index file. Structural .cdx files are automatically opened and updated when the associated table is opened with USE.

CDX( ) ignores any .idx (Microsoft FoxBASE+ and FoxPro 1.0 compatible index) files specified in USE or SET INDEX.

Use TAG( ) to return individual tag names contained in a .cdx, and NDX( ) to return the name of open .idx files.

When SET FULLPATH is ON, CDX( ) returns the path and name of the .cdx. When SET FULLPATH is OFF, CDX( ) returns the drive and name of the .cdx.