COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: cogloose on 10 Feb 2010 04:58:10 AM

Title: Display rows as columns
Post by: cogloose on 10 Feb 2010 04:58:10 AM
Hi

We have a user who would like to see their data spread over columns rather than rows so;
Customer ID 1   Customer Name 1   Item ID 1   Item Name 1
Customer ID 1   Customer Name 1   Item ID 2   Item Name 2
Customer ID 1   Customer Name 1   Item ID 3   Item Name 3
Customer ID 1   Customer Name 1   ..   ..
Customer ID 1   Customer Name 1   Item ID n   Item Name n
Customer ID 2   Customer Name 2   Item ID 1   Item Name 1
Customer ID 2   Customer Name 2   Item ID 2   Item Name 2
Customer ID 2   Customer Name 2   Item ID 3   Item Name 3
Customer ID 2   Customer Name 2   Item ID n   Item Name n

becomes;
Customer ID 1   Customer Name 1   Item ID 1   Item Name 1   Item ID 2   Item Name 2   Item ID 3   Item Name 3   ..   ..   Item ID n   Item Name n
Customer ID 2   Customer Name 2   Item ID 1   Item Name 1   Item ID 2   Item Name 2   Item ID 3   Item Name 3   ..   ..   Item ID n   Item Name n

ie all the data all on one row for each customer.
The problem being there are an unknown number of items per customer. I've tried using a crosstab in a list but seems very inefficient, does anyone have a tried and tested way to do this?
Any help would be appreciated
Title: Re: Display rows as columns
Post by: MFGF on 10 Feb 2010 05:37:16 AM
Hi,

You could try using a repeater within your list to display the Item IDs and Names, linked back to the list query via a master/detail relationship on Customer ID.  You would need to add spaces or commas between the items within the repeater too, or else they would end up as one long string.

Regards,

MF.
Title: Re: Display rows as columns
Post by: cogloose on 10 Feb 2010 05:47:53 AM
Thanks, think that will work.