Creating a dynamic variable based on user input inside a for loop such that loop breaks based on user input condition

I am new to KNIME and have a challenge implementing a basic use case scenario
I am trying to create a variable list of strings based on user input .

  1. So here I will read a file say file1.
  2. Copy this file1 table into another new table which will be fed to my for loop.
  3. For loop ----begins----
    a. Then I want to have an widget asking for the column name (drop down) to be selected
    from file 1 table.
    b. Ask the user (widget) if he wants to select another column name.
    -If the user mentions yes go back to step 3.
    - If the user mentions no come out of the for loop.
  4. At this step I get a list of all column names selected by user [‘column1’,‘column2’,‘column3’] which can be used as flow variable say in python node.

Things I know- how to create column selection widgets, how to read file,
Things I do not know- how to integrate all of this inside for loop , breaking it based on if/else condition based on user input.

I would appreciate If could receive a working workflow solution around this , for any demo file.
Also if any one suggest any tool/package/dashboarding solution knime extension which will help me achieve this easily on integrating with knime.(Just like we integrate Python snippets in KNIME workflows).

Hi @oshin

You can use the following node to end a loop based on the value of a variable

Example workflows that show how to use it are for the simple case:

And a more complicated one with if-else branches:



Hello @oshin,

welcome to KNIME Community!

Are you using loop only for user to choose columns and then to get column names into flow variable(s)? If so loop is not necessary and you can use Column Filter Widget node which outputs flow variable with column(s) selected. Loop makes sense if user has to decide whether more columns should be taken based on results from previous column processing. But this doesn’t seem to be a basic use case…


1 Like

Hi @ipazin That helps thanks! However this clarifies how I can take the column name from the user. What I am looking for is asking the user if they want to add one more column and hence the loop. Also I want all of these column names to be taken as flow variables (list if strings.)

Hi @gab1one Thanks this helped me understand that may be I can user variable for loop. However I would appreciate a solution which is inline with the steps I have mentioned in the above statement. Also I am not able to see where/how are we exactly appending the initial for loop result.
It would be helpful if you could help me with a working solution which is pretty much same to the steps mentioned above. :slightly_smiling_face:

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