Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Division by zero problems 1

Status
Not open for further replies.

sdzlkds

Technical User
Oct 20, 2005
41
GB
I have a report with a formula that takes data from the main report and two sub reports. I'm coming up with a division by zero error, and whatever permutation I try I cannot get round it!

The formula is

shared numbervar ACTIVITYCOUNT;
shared numbervar CASECOUNT;
100 * ((ACTIVITYCOUNT+CASECOUNT) / sum({@ACD - transferred out},{@Split Skill}))

and the error is 'shared numbervar ACTIVITYCOUNT; ' Division by zero.

I've tried changing the formula to

if ACTIVITYCOUNT = 0 then
100 * (CASECOUNT / sum({@ACD - transferred out},{@Split Skill}))
else
100 * ((ACTIVITYCOUNT+CASECOUNT) / sum({@ACD - transferred out},{@Split Skill}))

but still get the same error

The shared variable formulas in the subreports are

shared numbervar CASECOUNT :=
DistinctCount ({W_CASE_D.CASE_NUM}, {@Type})

shared numbervar ACTIVITYCOUNT :=
DistinctCount ({W_ACTIVITY_F.INTEGRATION_ID}, {@Type})

I am using Crystal 10

Any help would be appreciated
 
Hi,
If you display the 2 formulas ( CASECOUNT and ACTIVITY) in the main report do they have values?




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi again,
( Sorry I hit submit instead of edit)

I do not understand, however, a division by 0 error involving ACTIVITYCOUNT since I see no use of that variable as a divisor...




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Have you tried this:

shared numbervar ACTIVITYCOUNT;
shared numbervar CASECOUNT;
if sum({@ACD - transferred out},{@Split Skill})) = 0
then 0
else 100 * ((ACTIVITYCOUNT+CASECOUNT) /
sum({@ACD - transferred out},{@Split Skill}))

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top