COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: asmfloyd on 31 Jul 2019 09:28:51 PM

Title: Converting decimal to string
Post by: asmfloyd on 31 Jul 2019 09:28:51 PM
Hello,
  I have a decimal field in the database. I need to display the filed based on a condition as below:
     IF (FUND='A') then (VALUE1) else ('NA'). It works if I keep NULL instead of 'NA'.

I used to_char( and cast  function as below. But they are giving Oracle invalid number error. How should I move head?

Using cast:   IF (FUND='A') then (cast ((VALUE1),varchar(20))) else ('NA')
Using char(: IF (FUND='A') then (to_char(VALUE1)) else ('NA')

 

Thanks,
Title: Re: Converting decimal to string
Post by: BigChris on 01 Aug 2019 01:49:15 AM
Are you doing anything with that field after you put NA into it, for example have you got a total at the bottom of your report?
Title: Re: Converting decimal to string
Post by: asmfloyd on 01 Aug 2019 03:29:20 AM
No. Just showing detail level data only in the report. No summary totals are needed.
Title: Re: Converting decimal to string
Post by: asmfloyd on 01 Aug 2019 08:49:36 AM
I had to change the 'Total' function of that column to minimum. It is working as per my needs. Thank you BigChris for the inputs.