COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Topic started by: Sudha on 10 Oct 2005 09:54:45 AM

Title: Divide by Zero
Post by: Sudha on 10 Oct 2005 09:54:45 AM
Hi Friends,
How to handle Divide by Zero in CRN

For Eg,
I have a expression A/B
Do I need to use code like this
If
(B=0)
then (0)
else
(A/B)


Or

Just use A/B and CRN will take care of the Divide by Zero

My main concern here do we need to hardcode inform CRN to take care or CRN is going to take care of Divide By Zero even if we didn't take care of it.

TIA
Sudha
Title: Re: Divide by Zero
Post by: Draoued on 10 Oct 2005 10:14:30 AM
Hello Sudha,
I have deleted your very same post in Powerplay area.
You don't have to post the same question in multiple parts of the forum to get an answer more quickly, unless it was a mistake.


Have you tried your question by yourself in ReportNet ??
What was the result ?
Title: Re: Divide by Zero
Post by: Sudha on 10 Oct 2005 11:01:38 AM
First of all Posting in various places it was a Mistake, thanks for deleting it there becus I tried to Delete muself but could not.

Well when I tried this ...in 1 case
When I just write just A/B in the and run the Report I don't get anyout the whole Report was blank after running for a while.
So have to try the 2nd one with If-Then-Else statement and see...still going on

But I still need al valuable suggestions

Thanks
Title: Re: Divide by Zero
Post by: BIsrik on 11 Oct 2005 01:52:53 AM
check the option in the query .....

Srik
Title: Re: Divide by Zero
Post by: mallika on 11 Oct 2005 05:00:52 PM
by default when you divide one expression with another, reportnet internally uses the decode function (in oracle or its equivalent on other databases) to substitute the dividend (denominator) with a null if it is zero. This avoids division by zero errors. However a null is the result.

Title: Re: Divide by Zero
Post by: sir_jeroen on 12 Oct 2005 02:48:33 PM
Little reminder: close the topic if it's been solved/closed (see board rules)
Title: Re: Divide by Zero
Post by: Sudha on 12 Oct 2005 02:53:43 PM
No not yet