FOR() Function Returns Index Info in Uppercase Letters

ID: Q120791

2.60 2.60a | 2.60 2.60a

WINDOWS    | MS-DOS

The information in this article applies to:

SUMMARY

The FOR() function in FoxPro version 2.6 returns the index information in uppercase letters only. The FOR() function was added in the version 2.6 series for compatibility with dBASE. In dBASE, the information returned is in uppercase, lowercase, or a combination of both; it depends on how the text was typed originally when the index was created by using a FOR clause in the INDEX command.

MORE INFORMATION

Here's an example showing how the FOR clause and the FOR() function work. If the index was created by typing the following command in the command window on a database that has a field called name:

   INDEX ON name FOR name = 'Smith' TAG namsmith

this index will show only those records that have the word "Smith" in the name field.

If you type "? for()" (without the quotation marks) in the command window, FoxPro will display the FOR clause that was used in the INDEX expression. The expression will be in all uppercase letters (NAME="SMITH"). If a FOR clause was not used on the index, the FOR() function returns a null string value.

This could cause a problem in cases where code written in dBASE recreates an index based on the condition of the FOR() function. To work around this, you can change the code to:

   INDEX ON name FOR UPPER(name) = 'SMITH' TAG namsmith

The index would be then index on the uppercase of the word 'Smith'. Using a command such as SEEK would still look for the word 'Smith' and not for
'SMITH'.

Additional reference words: FoxDos FoxWin 2.60 2.60a KBCategory: KBSubcategory: FxinteropGeneral
Keywords          : kb3rdparty kbcode FxinteropGeneral 
Version           : 2.60 2.60a | 2.60 2.60a
Platform          : MS-DOS WINDOWS

Last Reviewed: May 22, 1998