Cannot make loop keep looping

Hello Knimers,

 

I have a simple loop controlled by a variable.  I change the variable inside the loop based on the time of day.  The loop is started with a "TableRow to Variable Loop Start" block and is concluded with a "Variable Condition Loop End" block.  The variable is defined upstream of the loop start via means of a Java Snippet.  It is modified inside the loop via a Java Snippet.  It is an integer: either 0 or 1.

 

The control should stop the loop if the variable is ever zero.  However, the loop only iterates once, no matter what the value of the variable is, or what I configure for the loop end condition inside the Loop End block.

 

Has anyone seen this before?

 

Thanks

Bill N

Can you please check the value of the variable at the node outport, tab "Flow Variable" while the Java node is only configured... I think, the problem is that the value is only set during execute.

Hi Gabriel,

 

Thank you for the reply!  As near as I can tell, when the nodes are reset, the variable as reported by the Variable Condition Loop End node exists, and is reported to have value "-1" even though there is nowhere in the workflow where I assign it that value.

 

Checking the "Flow Variables" tab of the Java snippet that recalculates the variable (when that node is reset) shows TWO copies of the variable, both with value "-1".  Despite my best efforts, the second java snippet always wants to create a new workflow variable with the same name as the first, despite a check in the "Replace" box for the output variable definition.  The second java snippet's variable appears to be ignored by the Loop End node.

 

I have created a very simple workflow that demonstrates the problem.  It has six nodes.  I would appreciate it very much if you could take a look at it.  I exported the workflow into a zip file and attached it to this note.

 

(I am running Knime 2.7.2.)

 

Best wishes,

Bill

Hi Bill, 

There was an error in the node description which was misleading (we will fix it).  Try using a regular loop start node instead.  I adapted your example and substituted in java edit variable nodes as they don't require the table creators.

Does that get you what you need?  Also, you may consider having the snippet node wait for 30 seconds or so in each iteration to save on your electricity bill.  That or you could use scheduled execution in the KNIME Server.

 

Best,

Aaron

Hi Aaron and Garbriel,


Thanks a bunch!  This is exactly the help I needed. 

 

See you around,

Bill Nowlin