Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recno()
Message
De
04/09/2000 15:31:55
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
04/09/2000 07:50:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00412139
Message ID:
00412296
Vues:
16
>It's a particularly useless number when you have an index in effect; the physical record number is not likely to match up with the logical record number; if you have a file with 500 records, with the first record having the name 'zygote' and the last record having the name 'aardvark', and you have it indexed on name, the record named 'zygote' will appear at or near the end of the list, and 'aardvark' near the beginning, but they'll keep their physical record number. People who try doing things based on RECNO() (for example, some people try to use RECNO() as the basis for alternating background line color in a grid) are usually pretty miffed at the result, since there's no guarentee that an even numbered record will be bounded by two odd record numbers. If you ave a filter in effect, so that only 10 of the 500 records are valid for processing/viewing, the RECNO() values stay the same. If you delete records, the record numbers stay the same - until you pack the file and remove dead
>records, and all records get renumbered.

Given these limitations, there are certain times when RecNo() can be very useful. I used it to simulate views in 2.x days, where I would Select *, recno() as rcn... into a cursor, which I then made read/write and operated on it until, in the end, I used the original record number as a backlink to the original file. This sort of thing assumes these numbers are temporary and valid only during the lifetime of the cursor, and we know the poor creatures don't live long.

Another good use of recno() was to mark a record when appending a few (hundred) records to a large table with many (hundreds of thousands of) records - the new records usually need some processing, and it's incomparably faster to set order to nothing and then just
go nRecord
replace rest xxxx with yyyy
then to do any sort of Replace For

In both of these examples the record numbers are treated as temporary and are not used across datasessions, across forms, and are definitely forgotten when the table closes. Any long-term relation between tables based on their record numbers, howewer, is doomed to bite its author in the back when least expected

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