Click or drag to resize

For Function

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

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION For(
	nIndexNumber,
	uArea
) AS STRING CLIPPER
Request Example View Source

Parameters

nIndexNumber (Optional)
Type: Usual
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.
uArea (Optional)
Type: Usual
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.
Or
Specifies the alias of the table for which For( ) returns the index filter expressions. X# generates an error message if you specify a table alias that doesn't exist.

Return Value

Type: String
Character
Remarks
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.
You can create filtered indexes in X#. 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