If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Case Statement help

Started by KEKeogh, 22 Jan 2009 11:54:05 AM

Previous topic - Next topic

KEKeogh

I'm trying to create the following case statement in Cognos 8.3 but I keep getting an error. 

Could someone point out what may be off?


CASE
WHEN ([DSR].[VIEW_APPLN_AVAIL].[APPLICATION_NAME] contains 'Tide') THEN ((([Total Base]-[Total Outage])/[Total Base])*.35)
else 'Null'
End


I get the following error:  "QE-DEF-0405  Incompatible data types in case statement."

Thanks!

Additional note after some more research:  [APPLICATION_NAME] is a text data item and the THEN part should return a percent.

Rajaggopal

This MIGHT have worked in ReportNET, but in Cognos 8 BI, all the results returned by a CASE or a IF statement must be of the same datatype. In this case your THEN clause is returning a numeric and your ELSE clause is returning a string 'Null'.

Either try to cast the numeric percentage value of your THEN clause to a string or return a numeric in your ELSE clause.

KEKeogh

Thank you!  Thank you!  Thanks you!

;D

That worked perfectly.  I knew it had to be something simple but since I'm new to coding the solution kept eluding me.