COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognos05 on 12 May 2015 12:26:01 PM

Title: replace 0 with a string '>25'
Post by: cognos05 on 12 May 2015 12:26:01 PM
Hi,

I have a column which will have values from 0 to 25

If a value is 0 then I have a requirement to show '>25'

If I try to do this in if else, it says different data types cant be assigned.

Can anyone help me how to do this..

Thanks,
Nithya
Title: Re: replace 0 with a string '>25'
Post by: BigChris on 13 May 2015 01:57:12 AM
You're trying to mix strings and numerics. You might need to cast the values:

if([Value] < 25) then ('<25') else (cast([Value],varchar(3))

Give it a try...
Title: Re: replace 0 with a string '>25'
Post by: cognos05 on 13 May 2015 07:59:25 AM
BigChris,

This is dimensional package and when I use the below code , I get a error
The 'cast' function is not supported in the context in which it is used.

Thanks,
Nithya
Title: Re: replace 0 with a string '>25'
Post by: CognosAnalytics on 13 May 2015 01:06:42 PM
Hello Nithya1224,
Apply data formatting to number, and set "0 value characters" to ">25".

-Cognos810