Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need SEEK loop
Message
De
30/11/1999 13:31:10
Rex Mahel
Realm Software, Llc
Ohio, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00296986
Message ID:
00297011
Vues:
21
>Beginner question -
>
>I'm trying to locate records in one table that have an exact match for certain fields in another table.
>
>LOCATE FOR fields and conditions works, but is extremely slow.
>
>What I am trying to code is based on the following:
>
>SCAN first table
>Get selected fields from first table into variables, including lcLname
>SEEK lcLname in second table
>if found, compare remaining fields
>if all fields matched, process
>if no match, re-SEEK lcLname and repeat until no more records match lcLname
>ENDSCAN
>
>I think want some variation of DO WHILE for FOUND() = .T., but I haven't been able to work out the syntax when the SEEK is inside the DO WHILE loop.
>
>Can you straighten me out?
>
>Thanks,
>Neil Preston

Neil,

Try something like this:

<\PRE>
SELECT FirstTable
SCAN
IF NOT SEEK(FirstTable.LName,"SecondTable")
LOOP
ENDIF
SELECT SecondTable
SCAN WHILE LName = FirstTable.LName
llAllFieldsMatch = .T.
FOR i 1 to lnNumberOfFieldsToCompare
IF FIELDS VALUES DO NOT MATCH
llAllFieldsMatch = .F.
EXIT
ENDIF
ENDFOR
IF llAllFieldsMatch
EXIT
ENDIF
ENDSCAN
IF llAllFieldsMatch
PROCESS
ENDIF
ENDSCAN
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform