COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: tclaesse on 20 Jun 2014 08:11:08 AM

Title: Is it possible to change numbers into text?
Post by: tclaesse on 20 Jun 2014 08:11:08 AM
Which expression do I use tot change all numbers in my page body into text.
Example : I will change all the numbers in letter 'X' (So I can only show that there are numbers)

In my package I tried :

if ([Amount]>-1) then ('X')
else (null)

But...In the properties I must always change my data format into text and by 'not applicable characters' I put the letter X.
The result now is OK but isn't there another solution by changing my expression above?

Thanks
Title: Re: Is it possible to change numbers into text?
Post by: MDXpressor on 20 Jun 2014 09:00:26 AM
I'm not sure I understand exact.. are you trying to accomplish scenario A, B, or something else?
A:
Amount       Has value gr 0
150                     X
-2                               
375                     X
0                         X

B:
Amount         Has value gr 0
150                      '150'
-2                                       
375                       '375'
0                           '0'                                 
Title: Re: Is it possible to change numbers into text?
Post by: tclaesse on 20 Jun 2014 09:22:46 AM
I want to show by every number the letter X

Example :

2547                 X
124.254            X
7524                 X
Title: Re: Is it possible to change numbers into text?
Post by: MDXpressor on 20 Jun 2014 09:29:59 AM
Then I think your if.. then.. else is the way to go.  if you need a selection of alpha representions (x, y, z, ...) then use a case statement:

Title: Re: Is it possible to change numbers into text?
Post by: tclaesse on 20 Jun 2014 09:34:48 AM
Yes, I used a 'if then else' statement but I wonder that in my expression above the 'X' has no result.
Only when I change the properties I described I get the result. I suppose my expression is not exact defined?
Title: Re: Is it possible to change numbers into text?
Post by: tclaesse on 20 Jun 2014 09:36:35 AM
When I use my expression before changing the properties I get -- -- -- in stead of X X X...in the body of my page.
Title: Re: Is it possible to change numbers into text?
Post by: MDXpressor on 20 Jun 2014 03:52:06 PM
Are you using a list or a crosstab container?

FYI, a crosstab expects numerical values and doesn't play well with text.  ... Used to be you couldn't use text at all, but that's going back to C8, or maybe even ReportNet... can't remember when text in crosstabs came in... 

Let me suggest you always work out your ideas in a simple format using the simplest layout (aka a list container).  Once your results are how you'd expect them in the list, then try adding the complexity of a crosstab.