Hello All. There is a saved search that calculates...
# general
s
Hello All. There is a saved search that calculates the tax rate of an invoice. It's been working consistently until yesterday. No changes have been made to the search but it now gives the unexpected error message when trying to run it. The report is using the formula percent field with the following formula : ({taxtotal}/{netamountnotax}) - I think something is off with the formula because the report runs when I remove it but of course that doesn't help since that's the data I need. Any suggestions?
e
If {netamountnotax} is null you'll get a divide by zero error. Change it to NVL({netamountnotax}, 1) so that it will return a value of 1 if it's null.
s
If the error says "An unexpected error has occurred. Contact support, etc, etc" could that still be referring to a zero error?
I gave it a try nonetheless and I can run the report but now the tax rate says ERROR: Invalid Expression
e
That just means that your formula is wrong.
a
this is division by zero, its not because of NULL, its because your data contains 0. To avoid it use such formula {taxtotal} / NVL( NULLIF( {netamountnotax} , 0), 1) NULLIFF returns NULL of both expression are equal and NVL returns 1 if first expression is NULL. So with such formula you cover two situations at once: 0 and NULL
👍 1
s
Thanks all! This solved it.