Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LOCATE and SET EXACT
Message
De
22/09/2003 17:31:37
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
LOCATE and SET EXACT
Divers
Thread ID:
00831267
Message ID:
00831267
Vues:
43
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform