I’m having a task which is to generate a distinct combination of units (encoded with letters A,B,C,D…). The combinations should not be duplicate (order of letters). If there are n letters, it’s supposed to create 2^n -1 combinations in total. This should be done in Alteryx by using iterative macro. Does anyone know how I can translate this Alteryx workflow to KNIME?
Input:
Output:
I created a workflow for you which creates all combinations / sets based on an input table. I’m not sure whether this is the most efficient way, though
Which logic did you use in your Alteryx Macro? Maybe we can copy this into the loop body (what I believe is the iterative macro in Alterxy).
Cheers
Kathrin
Tipp : Have you had a look at our free from Alteryx to KNIME booklet already? Alteryx to KNIME | KNIME
Hi @Kathrin
Thank you so much for your reply. I’m completely new to KNIME so my knowlege of this tool is very little. As for the iterative macro, first I create a logic to combine letters themselves (I think it’s cross join hier) then using formula tool to generate distinct combinations across the columns. After that, I split the combination into single letters units again then sort them ascending out. Then the duplicated combination would be identified and removed. I apply the same logic for 2,3,4 digit combination…until n-digit depending on the number of letters I have using iterative macro.
it this case your logic sounds really similar to what I’ve implemented in KNIME
Please have a look at the workflow and let me know in case you have any questions.
In addition I can recommend our free self-paced data wrangler courses to get started with KNIME (as well as the book from my previous message). In this workflow I use already advanced concepts of workflows like the loop and a flow variable to control the number of iterations. Therefore I recommend to have a look at the [L2-DW] KNIME Analytics Platform for Data Wranglers: Advanced course and here especially the sections flow variables and loops.
Thanks for the offered course!
Could you pls suggest which tool is equivalent to Contains? I’d like to do the If statement to check if the element in one column appear in another column (both are string) But the Like doesn’t seem to work. I want the column “Ausprägung” to return “Drache” if Combination contains Gruppe. In this example, AB contains A should return “Drache” instead of null.
you are almost there
In this case you need to add a * before the and after the group value (e.g. by using the String Manipulation node and the function join("*",$Gruppe$,"*") )
Afterwards you can use the Rule Engine node with the function LIKE. The * means any other character.