The best way to group groups #urgent

I though about a loop to match the items, tried a few things but was not able to finish it, would be interesting to see that in ‘pure’ KNIME. Would be about to add the items, split them, unite them again unique and do this for every line. Maybe I will give it another try to substitute the Python part.

2 Likes

Actually I did something like that (split and merge in sorted lists) in several layers but had the problem when one item which is at the beginning of a sorted list, is in the middle of another sorted list, so couldn’t complete the method.
I will try to do that in KNIME without coding as well. Let’s see if we can complete the task. (Before the topic is closed) :wink::blush:

4 Likes

Thanks for your help @mlauber71 and @armingrudd :+1:

4 Likes

Hi,
Here I have a new idea in which you don’t need to code and I think there cannot be any duplicate values in the output:

There is a recursive loop in which the platforms with a shared product are grouped together.
At first I thought I could do it without the recursive loop but there are some situations that make us use the recursive loop:
For example if the platforms were like this:
A,B
B,C
(2 layers) then everything were straightforward and we didn’t need a recursive loop. But if we have this:
A,B
B,C
C,D
(3 layers) then we need to do the process one more time (and one more loop for each additional layer).
I used a method so that you don’t need to set the number of loops manually but it does one additional loop (and finds out that the input and output row count are the same and then ends the loop). In your case it needs 4 recursive loops (the workflow does 5 loops) and the final row count is 156.
After the “Recursive Loop End” I added a few more nodes to add the products as well. (If you want the final lists to be sorted you can use a few more nodes to split and merge the items sorted)

Please check the workflow and let me know if it’s working as expected:
grouping.knwf (421.2 KB)

Best,
Armin

PS:

I think the solution by @mlauber71 is working perfectly fine (if you use a groupby node to group the two lists in his final output, you will get the same output as mine). I just wanted to provide a solution without coding.

3 Likes

Thanks a lot @mlauber71 and @armingrudd for your brilliant Ideas !!!

2 Likes

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