# Ungrouping multiple columns

**URL:** <https://forum.knime.com/t/ungrouping-multiple-columns/15516>\
**Category:** KNIME Analytics Platform\
**Created:** [June 17, 2019, 2:58pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516 "2019-06-17T14:58:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![KiroVandenBerg](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@KiroVandenBerg](https://forum.knime.com/u/KiroVandenBerg)\
**Post date:** [June 17, 2019, 2:58pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/1 "2019-06-17T14:58:41Z")

</div>

Dear knime users,

I have a hierarchical organized list, I like to create a workfow which allows me to switch between the hierarchical levels. The grouping works fine to me, but not the ungrouping.

Example:  
ID1\_\_\_ID2\_\_\_ID3\_\_\_ID4…  
G1\_\_\_\_M1\_\_\_a\_\_\_\_\_Z  
G1\_\_\_\_M1\_\_\_a\_\_\_\_\_Y  
G1\_\_\_\_M1\_\_\_b\_\_\_\_\_X  
G1\_\_\_\_M2\_\_\_b\_\_\_\_\_X

GroupBy ID2 - for Aggregation “Concatenate” and “;” as delimiter.  
This yields:  
ID1\_\_\_\_\_\_\_\_\_ID2\_\_\_ID3\_\_\_\_ID4  
G1;G1;G1\_\_\_\_M1\_\_\_a;a;b\_\_Z;Y;X  
…

Alternatively I used the GroupBy with “Unique concatenate”, this yields  
ID1\_\_\_ID2\_\_\_ID3\_\_\_\_ID4  
G1\_\_\_\_M1\_\_\_a;b\_\_\_\_Z;Y;X  
…  
I guess with the “Unique concatenate” information for the ungrouping gets lost?

However, now I want to reverse the workfow to yield the initial format.  
Since the ungrouping has to be done with many columns, the “Cell Splitter” “Ungroup” approach did not work for me.

Any suggestions?

Kind regards

Kiro

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [June 18, 2019, 9:26am UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/2 "2019-06-18T09:26:38Z")

</div>

Hi there Kiro,

Instead of _Concatenate_ you can use _List_ Aggregation and then you can use Ungroup node to revert to your original data format. If you need to use _Concatenate_ then you will have to use Cell Splitter node for each column on which you performed Concatenate aggregation to create list column. After that you can use use Ungroup node.

> [@KiroVandenBerg](#):
>
> I guess with the “Unique concatenate” information for the ungrouping gets lost?

Yes.

Try it out and if any question feel free to ask.

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![KiroVandenBerg](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@KiroVandenBerg](https://forum.knime.com/u/KiroVandenBerg)\
**Post date:** [June 19, 2019, 2:44pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/3 "2019-06-19T14:44:20Z")

</div>

Hi @ipazin,  
thank you, that helped me!  
Unfortunately, it causes trouble at later parts of the workflow - output to Excel.  
The workflow I have at the moment is:

 ![grafik](https://forum-cdn.knime.com/uploads/default/original/2X/a/a912537d15632606346567a215f27b3ee6db6771.png)

The output of the grouped list (middle excel sheet) now contains **only** the Group column (defined in the GroupBy Node).  
Approaches to change the list format to string like "Split Collection Column” - “Column combiner” as described here:

> [@Convert list of collections to string](https://forum.knime.com/t/convert-list-of-collections-to-string/11112):
>
> Hello I have a table that contains columns of type list of collections. I want to save the table to excel file. I cant do that because Excel writes node recognizes just other types for saving. What should I do? Best Malik

do not work for me since I have many columns and I do not want to have additional columns.  
Also, I want the data aggregated like in the list format, so that I can reverse the workflow (also when data are exported, altered and imported back to knime) but now I need a way to export the data. 😉

So in summary; “concatanate” (GroupBy) works for me to reduce the list, but than reversing the workflow does not work and “List” (GroupBy) allows me to reverse the workflow but than I can not export the aggregated list.

Any ideas?

Kind regards and thanks a lot!

Kiro

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [June 21, 2019, 10:17am UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/4 "2019-06-21T10:17:09Z")

</div>

Hi there Kiro,

not quite sure I understand what you are trying to accomplish but why not separating Middle and Last Excel sheet branches? Add another GroupBy node that would go from File Reader to Reference Column Resorter (Node 1067). And also if result of GroupBy and Ungroup nodes yield same data as File Reader do yuo need them?

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![KiroVandenBerg](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@KiroVandenBerg](https://forum.knime.com/u/KiroVandenBerg)\
**Post date:** [June 21, 2019, 11:11am UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/5 "2019-06-21T11:11:50Z")

</div>

Hi @ipazin,

yes, sounds weird what I try to accomplish 😉  
The point is, that I have an software output (File reader) which I like to condense to make it more useful and human readable for using the data outside the software e.g. in an excel sheet.  
However, if someone adds data into specific columns into the excel sheet, these additional data should be easily transferable back to the software, therefore I need a workflow which is reversable (like list aggregation via GroupBy) but also can be exported.  
Hope it makes sense now 😬

Kind regards and thank you for your support!

Kiro

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [July 11, 2019, 1:01pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/6 "2019-07-11T13:01:11Z")

</div>

Hi there Kiro,

sry for delay on this topic. It got buried away 🙂

Anyways have you managed to have some progress with it? To be honest still doesn’t make sense too me but that doesn’t mean it makes no sense for you to do it 😃

Can you try with some numbers like input data, output data, and what happens if something is added to Excel Sheet. That might help me understand and thus help.

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![KiroVandenBerg](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@KiroVandenBerg](https://forum.knime.com/u/KiroVandenBerg)\
**Post date:** [July 11, 2019, 5:39pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/7 "2019-07-11T17:39:46Z")

</div>

Hey @ipazin,

thank you for remembering!  
I had a solution, but I was not happy with it. Upon your request I started to re-think it and I found a solution, I can live with. But not sure if is the optimal or most elegant solution.

So here again my problem and how I solved it:  
Maybe this time I will be able to explain what I am doing ;))

The Original List (Table 1) contains several levels of hierarchy (in the example H1-H3),  
Each level contains several Values or Identifier Columns (in the example ID1-ID3).  
The first level, H1, contains a very rough grouping, the second level, H2, is interesting for  
the human user, the third level, H3, is important for the software.

Software output (Table 1)

 ![grafik](https://forum-cdn.knime.com/uploads/default/original/2X/a/a1feca350f2a34377d599290a5ac0a98454f1125.png)

Reduction of the software output to the second hierarchic level (Table 2)

 ![grafik](https://forum-cdn.knime.com/uploads/default/original/2X/0/0cbd7cc967101696328cb6a8beca397089b9bb60.png)

This is the desired „human readable“ Output. Unfortunately the columns aggregated via GroupBy – List can not be exported.  
However, since the H3 is not so important for the „human readable“ reference table, it is acceptable to not have the data from H3.  
So this is the output I get, when I export Table 2 to excel:

Table 3  
 ![grafik](https://forum-cdn.knime.com/uploads/default/original/2X/b/b60d4f0e175bbf7af309e338f14f076448ca7d75.png)

This Output might be manually edited e.g. replacing B to J in the “H2\_ID2” column.  
However, it seems as long as one column e.g. H2\_ID1 remains unaltered, this output can be combined with Table 1 with the joiner node. By selecting in the joiner node which column shall be used from which source (all “List Columns” from Table 1, all other columns from Table 3), the new List is equal to Table 1 besides the manual edit and can be imported back to the software.

Kind regards

Kiro

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [July 12, 2019, 1:59pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/8 "2019-07-12T13:59:51Z")

</div>

Hi Kiro,

tnx for detailed explanation. Think I got it and seems to me you did manage it well 😉

What I can add is that you can take a look (if you haven’t already) at the reporting tool integrated within KNIME called [BIRT](https://www.knime.com/node/20445). Maybe there you will find more possibilities if needed for these kind of reports.

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![KiroVandenBerg](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/k/a6a055/32.png) [@KiroVandenBerg](https://forum.knime.com/u/KiroVandenBerg)\
**Post date:** [July 12, 2019, 4:30pm UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/9 "2019-07-12T16:30:50Z")

</div>

Hi @ipazin,

thank you for supervising it!

And thanks for the link, looks really cool!

Kind regards

Kiro

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [January 11, 2020, 4:30am UTC](https://forum.knime.com/t/ungrouping-multiple-columns/15516/10 "2020-01-11T04:30:59Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
