COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: carioca10 on 03 Jun 2025 05:32:50 PM

Title: Need to group similar items in a column of a second column in a single line
Post by: carioca10 on 03 Jun 2025 05:32:50 PM
Need to group similar items in a column of a second column in a single line  in a report.

As follows:

Input

Field A   Field B
-----------   -----------
A1             B1
A1            B2
A2            B3
A3            B4
A3      B5

It would become:

Output   
Field A      Field B
------------      -----------
A1         B1, B2
A2         B3
A3         B4, B5

Cognos Version 12.0.4
Title: Re: Need to group similar items in a column of a second column in a single line
Post by: MFGF on 09 Jun 2025 08:31:50 AM
Quote from: carioca10 on 03 Jun 2025 05:32:50 PMNeed to group similar items in a column of a second column in a single line  in a report.

As follows:

Input

Field A   Field B
-----------   -----------
A1             B1
A1            B2
A2            B3
A3            B4
A3      B5

It would become:

Output   
Field A      Field B
------------      -----------
A1         B1, B2
A2         B3
A3         B4, B5

Cognos Version 12.0.4

Hi,

I'm assuming this is a list report? You could drop a repeater into the second column of the list, and set up a master/detail link between the query of the list and the query of the repeater (based on Column A). Add Column B into the repeater (plus comma/space etc as needed).

Cheers!

MF.
Title: Re: Need to group similar items in a column of a second column in a single line
Post by: FerdH4 on 20 Sep 2025 12:45:07 PM
I see your intended example output.  Just want to ask if this kind of similar (but not same) output might be acceptable as it's easy to produce in a List report.

Field A       Field B
-----------   -----------
A1             B1
                 B2
-------------------------
A2             B3
-------------------------
A3             B4
                 B5
-------------------------

The above can be done by Grouping the first column.

I can also image a way it might be done (or at least influenced) with a long Case statement but I don't know if all of the values/variables in both columns are always known to you.