Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Records Within the Same File
Message
De
22/07/1999 17:08:26
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
22/07/1999 10:59:54
Vernon Moeller
Texas Adjutant General's Department
Austin, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00244733
Message ID:
00245007
Vues:
28
>I have to work with a file that has 164 fields. I know: it needs normalization, but this is the government - we don't have time for efficiency!
>
>Is there an easy way to compare two records within the same file? I'd like to just say something like "IF Rec#1 = Rec#2 Do Something" - is this possible?
>
>Or will I have to compare them one field at a time?

You may open it in two workareas, provide the corresponding records are current, and, well, compare field by field. Then you have several options: you may scatter both to arrays and compare array elements, or do lots of Evals like this:

lEqual=.t.
=afields(aFlds)
for i=1 to fcount()
lEqual=lEqual and eval("alias1."+aFlds[i,1])==eval("alias2."+aFlds[i,1])
if not lEqual
exit
endif
endfor

Now lEqual should be .t. if they are equal. Still, this calculates two Eval()s for each field, and may be an overkill. I'd go for the scatter.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform