COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Rowan on 30 Jan 2008 07:41:59 AM

Title: Converting a number to a string.
Post by: Rowan on 30 Jan 2008 07:41:59 AM
Hi There.

I have seen this topic sort of discussed a few times recently but they always seem to assume access to the oracle database.

I have a data item that returns a number 1 thru 12 and I would like to convert it to display as the Month so 1 would display as January.

Is this possible to do in Report Studio?
Title: Re: Converting a number to a string.
Post by: almeids on 30 Jan 2008 08:25:44 AM
Do you mean that for some reason you don't want to use Oracle functions, like below?

to_char(to_date(to_char([your numeric column],'09'),'MM'),'Month')
Title: Re: Converting a number to a string.
Post by: Rowan on 30 Jan 2008 08:30:43 AM
I can use oracle functions inside Report Studio?

Unfortunately I'm pretty much a novice at this and been given a monster of a dataset that I can't change and must mould to fit the requirements from inside Report Studio.
Title: Re: Converting a number to a string.
Post by: almeids on 30 Jan 2008 10:29:11 AM
You can if the Oracle function set is included in the package you are working with, and I can't imagine that it wouldn't have been if that's your platform.  I'm not sure exactly "where" you can use them in C8 - we are still running Reportnet, where you can use them at the Tabular level but not at Query level.  Try putting the function in a calculated data item and see what happens.
Title: Re: Converting a number to a string.
Post by: almeids on 30 Jan 2008 10:44:44 AM
Another alternative, if you simply need to display the month name rather than use it in subsequent calculations, using Cognos function only:

_make_timestamp(2008,[your numeric value],1)

...then format the item on your report as Date with long display of month and no display of year or day