COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: asmfloyd on 08 Nov 2019 01:45:07 PM

Title: Providing a thousand separator for a char column
Post by: asmfloyd on 08 Nov 2019 01:45:07 PM
Hello,
  I have a char column which checks for couple of conditions and need to display results as *, '-',.. If the conditions are not met, I will get an integer result. For this integer result, how can I add
comma as a thousand separator?
  Since the column is coming as a character, declaring the format as number and adding thousand separator option is not working.

Thanks,
Title: Re: Providing a thousand separator for a char column
Post by: oscarca on 11 Nov 2019 04:08:15 AM
format([Integer];'#,0.00')

if the the Data item/column is a varchar you have to cast it first to a integer. Format(cast([Data item];integer);'#,0.00')

Best regards,
Oscar
Title: Re: Providing a thousand separator for a char column
Post by: asmfloyd on 12 Nov 2019 02:20:20 PM
Thanks much Oscar for the inputs.

I used the below which I got
  to_char(source,'9G999G999G990') 

Source:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77d3ccf7-3f8e-4144-876d-2f348e7b2bab