Solved

Divide by zero issue

Posted on 2004-03-25
3
413 Views
Last Modified: 2012-06-21
My report needs a calculated field called Daily Hours. To get this I would do the following in a perfect world.

({pusess.sesshours_no} / {pusess.scheddays_no})

But because the field {pusess.scheddays_no}) has NULL values it falls over saying in can’t divide by zero.

Now I tried     if isnull ({pusess.scheddays_no})  then 0.00 else ({pusess.sesshours_no} / {pusess.scheddays_no})

But Crystal gets in a loop of some sort and crashes. The only way I can make it work is to change all the NULL values to zero and use the following: -

if {pusess.scheddays_no} = 0 then 0.00 else ({pusess.sesshours_no} / {pusess.scheddays_no})

If anyone else has a better idea please let me know
0
Comment
Question by:Matt_Johnston35
  • 2
3 Comments
 
LVL 28

Assisted Solution

by:bdreed35
bdreed35 earned 125 total points
ID: 10678359
Crystal doesn't handle NULL values very well so you have to check for them if they are a possiblility in your data.

Since you have converted NULLS to the default, the way you handling it is the best way you can.

I would do it the same way.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 10680372
I would have expected
if isnull ({pusess.scheddays_no})  then 0.00 else ({pusess.sesshours_no} / {pusess.scheddays_no})

to work.  If it isn't I can't think of a better way than what you did but be careful that can cause other problems.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10683522
Glad I could help

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now