Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Specifying index
Message
De
27/03/1997 15:52:58
 
 
À
27/03/1997 15:28:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00025872
Message ID:
00025937
Vues:
27
>
>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.

Try this:

USE Memb IN 0
USE Zipdist IN 0 ORDER Zipcode

SELECT Memb
SCAN
IF LEN(ALLTRIM(Zipcode)) = 10
IF SEEK(Zipcode, "Zipdist")
REPLACE mcdist WITH Zipdist.cdist, ;
msdist WITH Zipdist.sdist, ;
hsdist WITH Zipdist.hdist
ENDIF
ENDIF
ENDSCAN

This assumes you have an index tag on the ZIPCODE field in ZIPDIST.DBF called ZIPCODE.

Generally, SEEK is the fastest method to search a table.

HTH!

-Doug-
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform