Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table header question
Message
 
To
23/09/2004 05:49:56
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00945261
Message ID:
00945359
Views:
22
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform