Returns the collating sequence for an index or index tag.
IDXCOLLATE([cCDXFileName,] nIndexNumber [, nWorkArea | cTableAlias])
- 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.
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.
- 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.
- Specifies the work area of the table for which IDXCOLLATE(В ) returns index file and index tag collating sequences. IDXCOLLATE(В ) returns the empty string if a table isn't open in the work area you specify.
- Specifies the alias of the table for which IDXCOLLATE(В ) returns index file and index tag collation sequences. Visual FoxPro generates an error message if you specify a table alias that doesn't exist.
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 Visual FoxPro's international support, see Developing International Applications.
The following example opens the
Customer table in the
testdata database. FORВ ...В ENDFOR is used to create a loop in which IDXCOLLATE(В ) is used to display the collation sequence of each index tag in the
Customer structural index. The name of each structural index tag is displayed with its collation sequence.
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\testdata') USE Customer && Open Customer table. CLEAR FOR nCount = 1 TO TAGCOUNT( ) IF !EMPTY(TAG(nCount)) && Checks for tags in the index. ? TAG(nCount) + ' ' && Display tag name. ?? IDXCOLLATE(nCount) && Display collation sequence. ELSE EXIT && Exit the loop when no more tags are found. ENDIF ENDFOR