Averages, minimums, and null values
Hi,
We want to report average and minimum scores for a number of people for
several tests, where not everyone has taken every test. Anyone who did not
take a test has a null value in the field for that test in their record.
If we use a TppDBCalc object with no modifications, we get 0 as the minimum
if anyone did not take a test, because Null is getting treated as 0.
Similarly, the average uses the record count as its divisor, so the average
we get is not the one we want, if there are records with no score for a
test.
Also, 0 is a valid score, and is not the same as not taking the test, so we
need to be able to distinguish the two.
Is this a case where we need to calculate the values ourselves, rather than
asking RBuilder to do it?
Thanks.
Mike Carroll
We want to report average and minimum scores for a number of people for
several tests, where not everyone has taken every test. Anyone who did not
take a test has a null value in the field for that test in their record.
If we use a TppDBCalc object with no modifications, we get 0 as the minimum
if anyone did not take a test, because Null is getting treated as 0.
Similarly, the average uses the record count as its divisor, so the average
we get is not the one we want, if there are records with no score for a
test.
Also, 0 is a valid score, and is not the same as not taking the test, so we
need to be able to distinguish the two.
Is this a case where we need to calculate the values ourselves, rather than
asking RBuilder to do it?
Thanks.
Mike Carroll
This discussion has been closed.
Comments
datapipeline field value in order to determine if this record value is null
or not. If it isn't null, then you can increment the value of one of the
TppVariables (the one used as the count). Then in the other OnCalc event
handler, increment the total value of the total TppVariable. You can do
this for the minimum and maximum fields also with variables. Check for null
and then compare it to the running minimum and maximum values. Use a
TppVariable for each infdividual calculation, instead of using TppDBCalcs.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
now it is almost useless !. Can you fix this ?
On Mon, 17 Jun 2002 12:57:43 -0500, "Jim Bennett \(Digital
different behavior, you'll have to code a TppVariable's OnCalc event handler
and make the variable skip nulls and include zeros when calculating.
Cheers,
Jim Bennett
Digital Metaphors Corp.
http://www.digital-metaphors.com
info@digital-metaphors.com