Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Searching a table and jumping to the record
Message
De
01/06/2005 15:13:23
 
 
À
01/06/2005 03:30:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01018885
Message ID:
01019095
Vues:
26
The code:

lcExact=SET('EXACT')
SET EXACT OFF
LOCATE FOR field1=trim(cField1) and field2=trim(cField2) and field3=trim(cField3);
and field4=trim(cField4) and field5=trim(cField5)
SET EXACT &lcExact

allows for searches that "begins with" the entered text only. I have found that a "contains text" search is broader and allows for partials:

LOCATE FOR ATC(ALLTRIM(cField1),field1)>0 and ;
ATC(ALLTRIM(cField2),field2)>0 and ;
ATC(ALLTRIM(cField3),field3)>0 and ;
ATC(ALLTRIM(cField4),field4)>0 and ;
ATC(ALLTRIM(cField5),field5)>0

To allow for multiple record matches, you can use a SELECT or a SCAN-ENDSCAN (and collect the record pointers to the matches). The and clause above requires all fields to match; if any field match can be a possiblity, then use an or clause.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform