Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

division by zero when export in Adobe

I have a report where I want to see the percentage of the amt that insurance company paid on the total amt charged.
I originally entered this formula but got a DIVISION BY ZERO error when exporting into Adobe.
 ccur({Archrg99.Ins_Paid}) % ccur({Archrg99.Chrg_Amt})

So, I tried to alter the appointment by entering  this formula but still get the error.
if {Archrg99.Ins_Paid} = "0"
then
0
else
(ccur({Archrg99.Ins_Paid}) % ccur({Archrg99.Chrg_Amt}))

The problem is that some insurance companies have not paid yet so the INS_PAID amount may be zero.  When I check the formula (either one) it says there are no errors and the report runs.  I only get the error when exporting in Adobe.

Can you help.
Kate Rogers
0
kvrogers
Asked:
kvrogers
  • 2
1 Solution
 
mlmccCommented:
Why are you checking the Ins_Pais amount.  You need to check the Chrg_Amt since that is the field you are dividing by.

mlmcc
0
 
James0628Commented:
Basically, what mlmcc said.  It's fine (mathematically) if Ins_Paid is 0.  That will just give you a 0 result.  If you're getting a "divide by 0" error, Chrg_Amt must be 0 (Or possibly null?) in some records, and that's the field you need to check.  If Chrg_Amt could ever be null, revise your formula to:

if IsNull ({Archrg99.Chrg_Amt}) or {Archrg99.Chrg_Amt} = "0"
then
0
else
(ccur({Archrg99.Ins_Paid}) % ccur({Archrg99.Chrg_Amt}))


 If Chrg_Amt won't be null, you can leave out the IsNull test.

 I assume from your test for = "0" (with quotes) that these fields are strings.  Obviously testing for "0" will only match that exact string.  If a zero could be represented in other ways ("00", "0.00", etc.), then you'd need to alter that test accordingly.  Likewise, if the fields could ever be something other than a number, you should test for that too.

 James
0
 
James0628Commented:
To be fair, if the problem was that you were checking Ins_Paid for 0 instead of Chrg_Amt, mlmcc probably deserves most of the credit (and points) for pointing that out first.

 James
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now