Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Specifying index
Message
From
28/03/1997 10:09:39
 
 
To
27/03/1997 15:28:50
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00025872
Message ID:
00026037
Views:
30
>>>I am USEing a table, SCANning it, and in the scan performing a SELECT on another table using a value from the first as the search key. How do I specify an index for the second table?
>>> I have only used work areas limitedly and am not completely comfortable yet, should I be using the tables in different work areas? I never opened the second table anywhere except in the select statement.
>>>
>>>By the way- Thanks to everybody for all your help with my sometimes silly questions in the past. As a VFP beginner, I feel I would be stuck out on a limb without your help. This is especially aimed at Edward, Dave, Arnon, and everyone else who has been quick to respond to my problems.
>>
>>So, I'm assuming that the code looks something like:
>>
>>Sele 0
>>Use FILE1
>>set order to tag TAG1
>>go top (or seek initvalue)
>>
>>SCAN
>> SELECT fieldlist;
>> from FILE1,FILE2;
>> where FILE2.idfield = FILE1.idfield
>> into RESULTFILE
>> (manipulate RESULTFILE)
>>ENDSCAN
>>
>>If my assumption is correct, you don't need to specify an index tag on the second file. Fox will determine if an index tag that it needs for he select exists and will use it. For Rushmore to work properly, you don't want ANY index tag active on the second file.
>
>Pretty close. Here's the code.
>
>use memb shared
>local array districts(3)
>scan
> if len(alltrim(zipcode)) = 10 then
> SELECT zipdist.cdist, zipdist.sdist, zipdist.hdist;
> FROM temptest!zipdist;
> INTO array districts;
> WHERE zipcode = memb.zipcode
>
> replace mcdist with districts(1)
> replace msdist with districts(2)
> replace mhdist with districts(3)
> endif
>endscan
>
>So VFP is automatically using any indexes it needs? I wanted to be sure, because it runs SOOOO SLOOOOW. (930 records/min) . BTW- I am in the habit of separating all of my REPLACEs because I've never been able to get a single replace to work with more than one pair of fields. I have followed the syntax in help to the T and I get syntax errors.


Ok...first standard question....where are your .tmp files going to?

As far as separating the REPL statements, remember, each one takes a 'tick' of processor time. The single replace statement would look like:

REPL mchist with districts[1], mshist with districts[2], mdhist with districts[3]
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform