>
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement