Loop and flow variable

Hi all,

I woudl like to change a flow variable (replace) in a loop and the loops ends when the variable meets the condition. Problem is that the variable seems to be “reset” to the initial value for each iteration. I tired setting variable by Java Edit Variable and TableRowToVariable Nodes but it does not change anything.

How can I get the next iteration to chose the newly set value?

see attached file for a very basic version of what I mean. In my case the snippet increases the variable by 1 correctly but on the next iteration its initial value is 0 again.

I am not 100% but my guess is that the variable value after configure and after execute is different, this is a know limitation and will be fixed for 2.8 -- you can use the Java Snippet (simple) which executes the Java code also during the configure step. Does this help at all?

But with simple snippet you can only output a new column and not change a variable?


you can solve this with the delegating nodes. (they are included in the ensemble extension)

I made you a workflow which solves your problem.

Best, Iris

Isn’t there a simpler way? I mean this is pretty basic stuff one would think.

Hm, this depends. We have a lot of different loops. Most probably based on what you are working on you can just use another kind of loop.

However if you want to have the full flexibility, so changing the variable in any possible way, I don't see an easier solution. 

If you tell me what you want to achieve, maybe there is an easier way.

Delegating nodes is the way, but admittedly this is not easy stuff. The nodes really should be called recursive loop start and end to make them more user accessible!

the table row to variable loop start and have a predefined table list to feed into this node certainly simplifies the usage. 

If you are simply incrementing the variable, then you can also use the counting loop start node.


infact every loop generates an additional variable called current iteration which increases the number by 1, starting with 0. This could be useful.