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!

divide by zero 2

Status
Not open for further replies.

bgon1

Technical User
Nov 5, 2005
11
CA
I have been trying to run a report where some of the denominators in a formula are zero ("cannot divide by zero"). The result is that the entire report is suspended. Is there a way to tell crystal to bypass the zero values or change them to another value ie. 1? Thanks for suggestions.
 
Add an introductory clause to each formula like:

if {table.denominatorvalue} <> 0 then //intro clause
{table.numeratorvalue}/{table.denominatorvalue} //original formula

-LB

 
hi
(if {table.denominatorvalue} = 0
or
isnull({table.denominatorvalue})
then
0
else
{table.numeratorvalue}/{table.denominatorvalue}

Durango122
if it moves and should not used Duck Tape
if does not move and should used WD-40
 
Note that if you need to do a null check, it should occur first in the formula, as in:

if isnull({table.denominatorvalue}) or
{table.denominatorvalue} = 0 then
0 else
{table.numeratorvalue}/{table.denominatorvalue}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top