Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indexed searches...
Message
From
18/07/2000 08:35:07
 
 
To
18/07/2000 08:13:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00393714
Message ID:
00393722
Views:
14
>Hi.
>
>I wonder if it's there any way to make searches on two field of the same table at the same time using indexes. I'm using the LOCATE command to search for the two fields wich must be iqual to certain variables. but it's gettin' to slow and the table it's not so big
>big already!!!
>The SEEK command it's eable to search just on one field at the time...or not...
>
>NOTE: I wonder if 'indexes' and 'searches' words are well written although :-)
>

You can create an index on an expression; for example, you could concatenate two character fields together to create an index based on both. For example, if you have a table with two character fields, you could build an index from the concatenation using the + operator. For example, with two fields lastname, 15 characters long, and firstname, 10 characters long, you could create an index based on lastname+firstname. When this index is used, you could use SEEK to find John Smith by:

SEEK PADR('Smith',15)+'John'

You need the PADR() so that the last name will be as long as the lastname field letting the first name start in the proper column of the expression getting examined.

Fields of differing types generally would need to be converted to strings for concatenating them under a single index.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform