hi I'm trying to finish a crystal report, summary report, but I'm getting division by zero error. I've looked up everything and none of the options have helped me. The options already out there have only made my math formula turn everything to a zero.
if 1-({@dspStkWip}+{tblItem.OnOrderQuantity}/{@dspNeed})*100 > .15
then crYellow
else CrNocolor;
So whats happening since the need has zeros in the column it will end up making everything 0. I just need to find a way to implement a check for zero and to see if it needs to be highlighted in the column.
The {@dspNeed} field looks like the culprit to me. If this field contains 0 or NULL values then you would get the division by zero error you described.
Try this:
IF {@dspNeed} <> 0 THEN
if 1-({@dspStkWip}+{tblItem.OnOrderQuantity}/{@dspNeed})*100 > .15
then crYellow
else CrNocolor
ELSE
\\ code for how to handle values that throw division by zero error goes here