COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: dri on 18 Mar 2016 10:11:35 PM

Title: Cognos Data Item
Post by: dri on 18 Mar 2016 10:11:35 PM
I need to create this data item. What would be the best way to write it in Cognos as a data item?

if {Status}="C" OR {Status}="CD" OR {Status}="D" OR {Status}="E" OR {Status}="ED" OR {Status}="EF" OR {Status}="A" OR {Status}="00" then "ADA"
else
if {Status}="CC" OR {Status}="AC" OR {Status}="DA" OR {Status}="EA" then "HCC"
else " "
Title: Re: Cognos Data Item
Post by: bus_pass_man on 20 Mar 2016 08:41:33 AM
You might want to try to simplify that expression.   Try a case construct.  Also think about using the IN operator.  I think your expression can be reformulated into something like this.   

CASE
WHEN ({Status} in ('C','CD'   etc. ) THEN ('ADA')
WHEN(status in ('CC', 'AC' etc) THEN ('HCC')
ELSE ""
END
Title: Re: Cognos Data Item
Post by: dri on 21 Mar 2016 10:24:43 AM
Thank you for the reply.

I did exactly like you mentioned here. Also, tried couple things. But it is giving me Parsing Error.
Title: Re: Cognos Data Item
Post by: bus_pass_man on 21 Mar 2016 07:53:35 PM
QuoteI did exactly like you mentioned here.

Usually there's more to error messages.  That might be a good place to start your troubleshooting.

Are you using single quotes?   Any quotes,  commas or brackets missing?  Is the error complaining about the use commas in the expression when your locale expects something else?


Quotetried couple things.
Such as?  What did you observe?