Rogue "Divide By Zero" error in 8.5
I have a report that is throwing a "Cannot Divide By Zero" error. I cannot for the life of me figure out what is in the data that is causing this. I have modified every formula that I can find to account for 0s as well. Is there an easy way to track down where this error is coming from? I'm fairly new to Crystal Reports...
Re: Rogue "Divide By Zero" error in 8.5
Welcome to CodeGuru forums!
One way to protect every division is in the next example
Code:
If {TableN.Quantity} <> 0 Then {TableN.Amount} / {TableN.Quantity} Else 0
Re: Rogue "Divide By Zero" error in 8.5
Quote:
Originally Posted by
jggtz
Welcome to CodeGuru forums!
One way to protect every division is in the next example
Code:
If {TableN.Quantity} <> 0 Then {TableN.Amount} / {TableN.Quantity} Else 0
I have put that If-Then statement around every place that I can find where I am doing division and I'm still getting it.
Re: Rogue "Divide By Zero" error in 8.5
In Crystal Reports ide, load the problematic report
click over Export button
>>Select "Report Definition"
>>Select "Disk File"
>>Click OK
It generate a txt file with all the report features... maybe it can help
Re: Rogue "Divide By Zero" error in 8.5
Quote:
Originally Posted by
jggtz
In Crystal Reports ide, load the problematic report
click over Export button
>>Select "Report Definition"
>>Select "Disk File"
>>Click OK
It generate a txt file with all the report features... maybe it can help
Thanks! That was a huge help. I just reviewed the file and every one of my formulas that are doing division look like this...
if tonumber({REPORT.LBS_TOTAL}) > 0 then
tonumber({REPORT.GAL}) * tonumber({REPORT.LBS_PER_LOAD}) / tonumber({REPORT.LBS_TOTAL})
else
0
Re: Rogue "Divide By Zero" error in 8.5
How do I find out what the current database driver is? It looks like I need to change the driver, but I need to know what it currently is so I can change it back.