Hi @ScottF , I had the same reaction at first, that is to use a Cross Joiner. But looking at the desired output, it’s not. It’s not joining all records from Name 1 to Name 2, but rather combining all combinations of single word of Name 1 and Name 2 of the same row. Though eventually the Cross Joiner can be used after some initial manipulations and within a Loop (Group Loop by ID)
@Reader91 , for ID 1, should you not also have these 3:
1 Rossi Luigi
1 Rossi Verdi
1 Rossi Luigi Verdi
Maybe Pythons Itertools package can help you here, specifically combinations from it.
Otherwise like @ScottF suggested maybe first split and ungroup the data and then a crossjoin.
Not a perfect solution but maybe it gets you started.
Hi @Reader91 , I’ve come up with something using Python. The reason why I used Python is that it has a function called combinations() from the itertools library, and it basically finds all combinations for you automatically.
I know I asked this: “while you have Mario Luigi Verdi, can you also have Mario Verdi Luigi?”. This is more of a permutation for that combination. Combination-wise, you will get only “Mario Luigi Verdi”.
If you want all permutations of all combination, we can also add a permutation on top of these combinations. Python also has a permutations() function
Thank you @bruno29a for the solution. Very appreciated
I have one question because when I start the python script I receive an error message saying
ERROR Python Script 0:3 Execute failed: Could not start Python. There are problems with your Python environment:
Could not start Python executable at the given location (no_conda_environment_selected\python.exe): Cannot run program "no_conda_environment_selected\python.exe": CreateProcess error=2,
Hi @Reader91 , since you don’t have Python installed, I’ve written an alternate version in Java. You should not need to install Java as Knime comes with an embedded version. I get the same combinations. I’ve also optimized the logic where instead of starting with 1 element for combinations, I start with 2, that way I don’t need to do row filter anymore. I’ve added that optimization in both the Python and Java version.
The new workflow has both versions, and looks like this:
EDIT: I would still suggest that you get Python installed. You’re limited if you don’t have Python. Python is essential when you need to access several other rows while processing a row (which is NOT in this case, hence why it was doable in Java). But if you are restricted for time, you can use the Java version for this workflow in the meantime.
Hi @Luca_Italy , I would not say that the Java language is “limited” compared to Python, I think it’s just a matter of how Knime decided to allow Python to navigate through the rows, but not with Java. Java has the same capability - it’s just an array in the end.