Overwrite variable inside loop

hi all,

I am looking for a way to overwrite variable value within loop.

What i want to achieve:

  • initialize variable A outside delegating loop
  • inside loop, I calculate a score.
  • If the score is higher than variable A, certain rows are updated and variable A is overwritten by the value of the new score.
  • In the end, I want see the result of the variable A

Right now, it seems that variable A is always back to its initial value in each loop.

I made a very simple workflow as an example. In the end i want to see 6 as the score of variable A.


everything which you want to change inside the loop (e.g. change in each iteration) can only be done by using the recursive loops. However they do not sent variables back.

But you can use the Recursive Loop (2 Ports) and pass the variables back on the second port.

Cheers, Iris

PS: the delegating loops are now replaced by the recursive loops. The delegating ones will be deprecated in a later version of KNIME

Thanks for the help. I think Recursive loop will partially do the trick.

But it is confusing to see that the loop does not update variable with the same name that is initialized before the loop.

1 Like