JavaScript Editor js editor     Web development 



Main Page

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.

Return Value

Character

Remarks

You can create filtered indexes in Visual FoxPro. If you include the optional FOR lExpression clause in INDEX, the index file acts as a filter on the table. Only records that match the filter expression lExpression are available for display and access. Index keys are created in the index file for just those records matching the filter expression.

USE and SET INDEX both support an index file name list that makes it possible for you to open multiple index files for a table. Any combination of single-entry index file names, structural compound, or independent compound index file names can be included in the index file name list. FOR(В ) is similar to SYS(2021) and is provided for compatibility with dBASE IV.

See Also



JavaScript Editor js editor     Web development