Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching a table and jumping to the record
Message
From
01/06/2005 15:13:23
 
 
To
01/06/2005 03:30:49
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01018885
Message ID:
01019095
Views:
25
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform