Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LOCATE and SET EXACT
Message
From
22/09/2003 17:31:37
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
LOCATE and SET EXACT
Miscellaneous
Thread ID:
00831267
Message ID:
00831267
Views:
42
In the following code sample the top LOCATE doesn't find the record yet when the value is ALLTRIMed, as in the second LOCATE, it does.

Am I missing something here or is this a bug?
SET EXACT OFF 

CREATE CURSOR t1 (Flda C(12), Fldb C(5))
INSERT INTO t1 (Flda, Fldb) VALUES ("XXXXXXXXXX  ", "YYYYY")
INSERT INTO t1 (Flda, Fldb) VALUES ("YYYYYYYYYY  ", "ZZZZZ")
INSERT INTO t1 (Flda, Fldb) VALUES ("XXXXXXXXXX  ", "AAAAA")

CREATE CURSOR t2 (Fld1 C(10), Fld2 C(5))
INSERT INTO t2 (Fld1, Fld2) VALUES ("XXXXXXXXXX", "YYYYY")
INSERT INTO t2 (Fld1, Fld2) VALUES ("YYYYYYYYYY", "ZZZZZ")

SELECT t1
GO TOP 
SCAN FOR Flda = "XXXXXXXXXX"              && finds this OK
    SELECT t2
    LOCATE FOR Fld1 = t1.Flda             && doesn't find t2 rec 1. Shouldn't it?
    IF FOUND()                            && ...for either t1 rec 1 and t1 rec 3
      WAIT WINDOW "It was found!!!"
    ELSE 
      WAIT WINDOW "NOT found!?!?"
    ENDIF 
    LOCATE FOR Fld1 = ALLTRIM(t1.Flda )   && now finds t2 rec 1, as expected, for both
    IF FOUND()
      WAIT WINDOW "It was found when ALLTRIMed!!!"
    ELSE 
      WAIT WINDOW "NOT found!?!?"
    ENDIF 
ENDSCAN
cheers
Next
Reply
Map
View

Click here to load this message in the networking platform