>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only