Iterative macro

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?

Thanks so much for reading!

Hi @Tram_Nguyen,

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 :wink:

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).


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.


Hi @Tram_Nguyen,

it this case your logic sounds really similar to what I’ve implemented in KNIME :slight_smile:

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.

Hi @Tram_Nguyen,

you are almost there :slight_smile:
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.

Below a little example:
Input Table:
Screen Shot 2022-08-31 at 16.25.42

Settings Rule Engine:



PS: To keep our forum tidy and to make it easy to find answers please create individual threads for individual questions :slight_smile: Thank you!


Thank you very much for the clear instruction. It’s solved!


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