COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ravikrsingh on 22 Feb 2013 02:42:49 AM

Title: Concatenation issue
Post by: ravikrsingh on 22 Feb 2013 02:42:49 AM
Hi All,
I have a field Distance (which is of datatype DOUBLE in DB2). This field contains data in meters.So I am dividing it by 1000 to convert in KM. DataItem1 = Distance /1000 ex: 14015/1000 = 14.015 which I am getting correctly.

In the next data item I am trying to display this with KM.
DataItem2: cast(DataItem1,VARCHAR(20)) || 'KM'. In this case it returns 1.4015E1KM.

Can anyone pls tell why I am getting the value like this.


Title: Re: Concatenation issue
Post by: adik on 22 Feb 2013 03:16:13 AM
try cast(DataItem1 as VARCHAR(20)) || 'KM'
this works for me at least
Title: Re: Concatenation issue
Post by: ravikrsingh on 22 Feb 2013 03:28:29 AM
Hi Adik,

For me its not working. Still I am getting the same result as 1.4015E1KM.
Title: Re: Concatenation issue
Post by: RandomHunter on 22 Feb 2013 04:07:42 AM
Hi,

maybe you could apply a number format to dataitem1, i case you hadn't already.

Hunter
Title: Re: Concatenation issue
Post by: ravikrsingh on 22 Feb 2013 04:58:58 AM
Did't worked :(
Title: Re: Concatenation issue
Post by: adik on 22 Feb 2013 07:25:54 AM
where in the report are you trying to display the casted data item? in a list/crosstab measures cells?
Title: Re: Concatenation issue
Post by: ravikrsingh on 23 Feb 2013 12:14:48 AM
Its in list.
Title: Re: Concatenation issue
Post by: adik on 23 Feb 2013 05:26:41 AM
in this case why don't you put in the list DataItem1, unlock cells and drag a text item next to it in the cell and type " KM" (without the quotes)
Title: Re: Concatenation issue
Post by: ravikrsingh on 24 Feb 2013 10:48:29 PM
It worked.
Thanks Adik. :)