FOR() Function Returns Index Info in Uppercase Letters

Last reviewed: November 21, 1995
Article ID: Q120791
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions, 2.6, 2.6a
  • Microsoft FoxPro for MS-DOS, versions, 2.6, 2.6a

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: kbprg kbcode kb3rdparty
KBSubcategory: FxinteropGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.