FOR( ) Function

Returns the index filter expression, in uppercase, of an open single-entry index (.idx) file or an index tag.

FOR([nIndexNumber [, nWorkArea | cTableAlias]])

Parameters

If you don't include any of the optional arguments, FOR( ) returns the index filter expression for the master index file or index tag. If a master index file or index tag isn't in effect (for example, you've issued SET ORDER TO to place the table in physical record order), FOR( ) returns the empty string.

nIndexNumber

Specifies the index file or tag for which the filter expression is returned. FOR( ) returns filter expressions in the following order as nIndexNumber increases from 1 to the total number of open single-entry files and structural compound and independent compound index tags:

  1. Filter expressions from single-entry index files (if any are open) are returned first. The order the single-entry index files are included in USE or SET INDEX determines the order in which the filter expressions are returned.

  2. Filter expressions for each tag in the structural compound index (if one is present) are returned next. The filter expressions are returned from the tags in the order the tags are created in the structural index.

  3. Filter expressions for each tag in any open independent compound indexes are returned last. The filter expressions are returned from the tags in the order in which the tags are created in the independent compound indexes.

    The empty string is returned if an index or index tag is created without a FOR clause or if nIndexNumber is greater than the total number of open single-entry files and structural compound and independent compound index tags.

nWorkArea

Specifies the work area of the table for which FOR( ) returns the index filter expressions.

FOR( ) returns the empty string if a table isn't open in the work area you specify.

cTableAlias

Specifies the alias of the table for which FOR( ) returns the index filter expressions.

Visual FoxPro generates an error message if you specify a table alias that doesn't exist.

Expand imageReturn Value

Expand imageRemarks

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic