Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table header question
Message
 
À
23/09/2004 05:49:56
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00945261
Message ID:
00945359
Vues:
21
>>lnCalculatedReccount = (lnFileSize-(lnFirstRecPos+1))/lnRecordSize
>>lnCalculatedReccount = FLOOR((lnFileSize-(lnFirstRecPos+1))/lnRecordSize)
>>
>>I want to repair damage to my headers, so which answer is correct?

>John,
>Floor() one is the correct one. However +1 there was related with Fox2x tables. Since now everyone assumes and uses VFP tables I edited code on wiki site and dropped it. Thanks for reminding.
>lnCalculatedReccount = FLOOR((lnFileSize-lnFirstRecPos)/lnRecordSize)
>
>Floor is necessary because sometimes table is off by one record due to incomplete record at end (ie: recsize=100 but last record lenght is say 70). VFP might not say anything on that situation but it's an error IMHO.
>Cetin

Hello Cetin

I've been using ROUND(). For example, a table has a file size of 883810, a first data pos of 1000, and a record size of 306.

(883810 - (1000 + 1))/306 = 2884.996

FLOOR() would make that 2884 while there are actually 2885 records. ROUND(2884.996, 0) makes it 2885 which is correct.

Have I got this right?
John
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform