Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LOCATE and SET EXACT
Message
From
22/09/2003 18:05:16
 
 
To
22/09/2003 17:31:37
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00831267
Message ID:
00831273
Views:
15
Why do you think the first one should work? You're looking for:
t2.fld1      t1.flda
"XXXXXXXXXX"="XXXXXXXXXX  "
>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
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform