Click or drag to resize

IdxCollate Function

X#
Returns the collating sequence for an index or index tag.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION IdxCollate(
	uIndex,
	nIndex,
	uArea
) AS STRING CLIPPER
Request Example View Source

Parameters

uIndex (Optional)
Type: Usual
Specifies the name of the compound index file. The compound index file you specify can be the structural compound index file automatically opened with the table or an independent compound index file.
nIndex (Optional)
Type: Usual
Specifies the index or index tag for which IDXCOLLATE( ) returns the collating sequence. IDXCOLLATE( ) returns the collating sequence for indexes and index tags in the following order as nIndexNumber increases from 1 to the total number of open index files and index tags:
Collating sequences for single-entry .idx index files (if any are open) are returned first.
The order in which the single-entry index files are included in Use or Set Index determines how the collating sequences are returned.
Collation sequences for tags in the structural compound index (if one is present) are returned next. The collating sequences are returned for the tags in the order in which the tags are created in the structural compound index.
Collating sequences for tags in any open independent compound indexes are returned last. The collation sequences are returned for the tags in the order in which the tags are created in the independent compound indexes. The empty string is returned if nIndexNumber is greater than the total number of open index files.
uArea (Optional)
Type: Usual
Specifies the work area number of the table for which the lock status is returned. If you omit cTableAlias and nWorkArea, the collation sequence is returned for the table open in the current work area.
Or
Specifies the alias of the table for which the lock status is returned. An "Alias not found" error message is generated if you specify an alias of a table that isn't open.

Return Value

Type: String
Character
Remarks
IDXCOLLATE( ) can be used to return the collating sequence for each tag in multiple-entry compound index files, allowing you to completely delete an index file and rebuild it correctly, using a series of Set COLLATE and Index commands. Note that IDXCOLLATE( ) is not required for the proper functioning of REIndex, because the collation sequence information is present in existing indexes and index tags. For additional information about X#'s international support, see Developing International Applications.
Examples
X#
 1Close Databases
 2Open Database (HOME(2) + 'Data\testdata')
 3Use Customer     // Open Customer table.
 4Clear
 5For nCount = 1 TO TAGCOUNT( )
 6IF !EMPTY(TAG(nCount))  // Checks for tags in the index.
 7? TAG(nCount) + ' '  // Display tag name.
 8?? IDXCOLLATE(nCount)  // Display collation sequence.
 9ELSE
10EXIT  // Exit the loop when no more tags are found.
11ENDIF
12ENDFor
See Also