COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: dssd on 03 Jun 2013 12:25:58 PM

Title: Concatenate rows in one row
Post by: dssd on 03 Jun 2013 12:25:58 PM
Is there a way to concatenate rows of data in a column into one rwo separated by commas

Country
US
UK
China


should become    US, UK, China   as a row in the report.
Title: Re: Concatenate rows in one row
Post by: Lynn on 03 Jun 2013 12:34:17 PM
Try using a repeater layout container.

http://www.cognoise.com/index.php/topic,16831.msg49217.html#msg49217
Title: Re: Concatenate rows in one row
Post by: nawaz84@yahoo.com on 04 Jun 2013 11:30:33 AM
cast ([Account_Id],varchar(10))+cast([Customer_Id],varchar(10))

Cast is used becuase account id is integer
Title: Re: Concatenate rows in one row
Post by: Lynn on 04 Jun 2013 12:36:29 PM
Quote from: nawaz84@yahoo.com on 04 Jun 2013 11:30:33 AM
cast ([Account_Id],varchar(10))+cast([Customer_Id],varchar(10))

Cast is used becuase account id is integer

:o

That will concatenate two different fields within the same row. It will not do anything to take data from multiple rows and put them into a single row.
Title: Re: Concatenate rows in one row
Post by: RKMI on 04 Jun 2013 05:56:51 PM
I agree with Lynn, her solution works. Other reply is if you want to concatenate two fields which is a different topic.  ;D
Title: Re: Concatenate rows in one row
Post by: Satheesh on 05 Jun 2013 01:03:37 AM
Hi,
      Take One more Data Item named as Country2
Write a case stmt in that Data Item using Country Key like below
Country2
case
when ( [country_key] between <starting number> and <Ending Number>) then
([Country]||', ')
end


Unlock your layout drag Repeater object and drop in your Country 2 list column(Here you hv to take country2 in place of country data item)and drag ur country2 into repeater.
you will get your expected result.


Thanx
Sateesh