Page 1 of 1

Error message on Calculation

PostPosted: Sun Jul 12, 2015 10:38 am
by BRobinsonS
Scrolling with a Master/Detail set of table, I want to Add or Subtract two field in the Detail table to display the difference.
If the at least one of the field has a value then it calculates correct (except - *read below)
If there is no record for the detail table, the Calculation shows 'Error' for the Subtraction (or Addition).

*If an error occurs, the next master/detail that does have a valid number for one of the field in the detail table but does not clear the error.

This applies to Report Designer too.

How do I get Neobook / NeobookDBPro and Report Designer to indicate Zeros for the Calculation and not 'error' ?

Re: Error message on Calculation

PostPosted: Sun Jul 12, 2015 11:41 am
by Neosoft Support
You could try setting a default value of 0 (zero) for the fields to prevent the calculation from failing. The default value can be set when you define the fields in dbpCreateTable.

If that doesn't work, can you provide a small sample pub and db that demonstrates what you are doing?

Re: Error message on Calculation

PostPosted: Mon Jul 13, 2015 8:12 am
by BRobinsonS
I have finally tracked down the problem.
Apparently 'MATH' does not allow you to subtract two currency values when the second number is greater than the first.
i.e. Math "[First]-[Second]" "2" "[Diff]" results in 'Error' when [Second] is greater.

So now I test to see if First is larger, then do Math above else Math "[Second]-[First]" "2" "[Diff]"
Then SetVar "[Diff]" "-[Diff]"

Re: Error message on Calculation

PostPosted: Mon Jul 13, 2015 9:31 am
by Neosoft Support
If the numbers are formatted as currency, then you might also need to remove the currency symbols before performing the calculation.