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 Chris Miller 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 error

Status
Not open for further replies.

sealster

Technical User
Jan 7, 2004
3
GB
I am a new crystal report wtiter. My poblem is that I have created a simple report that run from 4 5 parameters,one of these parameters a figure is physically typed when prompted. I need to divide this figure by a figure already created as a field in crystal. I am getting an error "Division by zero" error. When checking all the formats, they are set as a number, however even though the parameter is set as a number, when you scroll over the field it prompts that it is a string.
Hope this is enough info.
Sealster

 
Sorry about the spelling mistakes. It is actually 5 parameters.
 
Anytime I do division in Crystal, I create a formula to check for problems such as division by zero. Try something like:
If not isNull({Field.Denominator}) and {Field.Denominator} <> 0 then
{Field.Numerator} / {Field.Denominator}
Else 0;

 
hi

read this tread

thread767-566422

cheers

pg

pgtek
 
pgtek,

thankyou, I looked at the thread case.

I typed in the formula:

if not(isnull({@JO Tot}))
and
{@JO Tot} <> 0 then
{Contact.Page Advert Cost}/{@JO Tot}

This got rid of the error I was getting. However the resulting number is the same as in the field contact.page advert. Even though we have 2 figures( contact.page advert cost:2000 and @JO Tot:7.

These numbers are in the report and still I only get the answer of 2000.00

Sealster
 
Try a display to check whether the fields really have the values you think they have. Use SaveAs to create a special test version, if necessary.

Madawc Williams
East Anglia, Great Britain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top