Subject |
Re: SUM |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sun, 14 Jan 2024 11:29:03 +0200 |
Newsgroups |
dbase.getting-started |
On 2024/01/13 13:57, Jerry Frost wrote:
> Problem solved. I copied the table to another filename and now runs properly. Thanks to all for your prompt assistance.
I'm always unhappy if the reason for a problem can't be pinned down.
Even though it has gone away there is always the chance that it will
happen again. If the problem is identified one can at least create a
work-around for future use.
Simply copying a table should create an exact copy, warts and all, of
the table and its .dbf an .mdx files if they exist or it should fail if
it finds a problem. An old trick for rescuing a table with a corrupt
record, especially where a memo field is the culprit, is
copy to newtablename for recno() <> corrupt_recno
When copying a table, any null values in fields will be carried over to
the new table. The only exception is that the table is packed i.e any
deleted records are discarded.
As Akshat has pointed out, null values in fields can cause problems but
this is not always the case. In your case, if the problem was due to a
null value the result of summing the ENTRYFEE field should have been
blank (null) and not 0.00. In any case any nulls are also in the new
table so this can't be the issue as the problem has gone away.
I've done a bit of digging in where a null value in a field will cause
problems.
DML
sum fieldValue to mVar Null does not cause a problem
mVar += fieldValue Null does not cause a problem
mVar = mVar + fieldValue Null causes a problem.
OODML
sum(fieldValue) Null does not cause a problem
mVar += fieldValue Null causes a problem
mVar = mVar + fieldValue Null causes a problem.
Mervyn.
|
|