Partilhar via


NDX( ) Function

Returns the name of an open index (.IDX) file for the current or specified table.

NDX(nIndexNumber [, nWorkArea | cTableAlias])

Return Values

Character

Parameters

  • nIndexNumber
    Specifies which .idx file name to return. USE and SET INDEX both support an index file list that makes it possible for you to open .idx files for a table. The order of the file names in this index file list determines which .idx file name NDX( ) returns. For example, if nIndexNumber is 1, NDX( ) returns the name of the first .idx file in the index file list; if nIndexNumber is 2, NDX( ) returns the second .idx file name, and so on. NDX( ) ignores names of compound index (.cdx) files in the index file list.

    NDX( ) returns an empty string if nIndexNumber is greater than the number of .idx files in the index file list.

  • nWorkArea
    Specifies the work area number for .IDX files open in a work area other than the current one. NDX( ) returns an empty string if no table is open in the work area you specify. If you omit nWorkArea, NDX( ) returns the names of .idx files open with the table in the current work area.

  • cTableAlias
    Specifies the table alias for .idx files open in a work area other than the current one. If no table has the alias you include, Visual FoxPro generates an error message. If you omit cTableAlias, NDX( ) returns the names of .idx files open with the table in the current work area.

Remarks

The CDX( ) and MDX( ) functions can be used to return the names of open compound (.cdx) index files.

In Visual FoxPro for Windows, when SET FULLPATH is ON, NDX( ) returns the path to the .idx file with the .idx file name. When SET FULLPATH is OFF, NDX( ) returns the drive the .idx file resides on with the .idx file name.

See Also

CDX( ) | INDEX | MDX( ) | SET FULLPATH | SET INDEX | SYS(14) - Index Expression | TAG( ) | USE