ID: Q127873
The information in this article applies to:
CDX tags containing a conditional test for the length of the key expression may return a different result set between FoxPro version 2.5 for MS-DOS and FoxPro version 2.5a (or higher) for MS-DOS, where trailing spaces (blanks) are stored with keys or are used to search for keys.
This problem occurs only when using an untouched version 2.5 table and CDX in a later version.
There was a minor change in how the CDX tag is stored and read from the CDX file between version 2.5 and later versions. This change was made to accommodate index key construction for other-than machine collation sequences.
Reindex the file in the current version.
This behavior is by design.
1. Copy and run the following code in FoxPro version 2.5 for MS-DOS:
CREATE TABLE cdxtest (f1 C(10))
INDEX ON f1 TAG f1 FOR f1 <> "ABCD"
APPEND BLANK
REPLACE f1 WITH "ABC"
* Find a string with no trailing blanks
? "'ABC'"
SEEK ("ABC")
? FOUND() && Returns true in all versions
* Find a string with trailing blanks
? "'ABC '"
SEEK ("ABC ")
? FOUND() && Returns true in 2.5
2. Copy and run the following code in version 2.5a or later:
USE C:\fpd25\cdxtest ORDER f1 && Open the file created in 2.5
* Find a string with no trailing blanks
? "'ABC'"
SEEK ("ABC")
? FOUND() && Returns true in all versions
* Find a string with trailing blanks
? "'ABC '"
SEEK ("ABC ")
? FOUND() && Returns *FALSE* until reindexed.
3. Reindex the file in the later version. Then run the code again. Notice
that the second SEEK where the string has trailing blanks is found this
time.
Additional reference words: FoxDos 2.50a 2.50b 2.60 2.60a
KBCategory: kbusage kbprb
KBSubcategory: FxotherGeneral
Last Reviewed: March 23, 1995