Cannot overwrite a variable to regulate a Recursive Loop End node

Dear KNIME communauty,

I am facing some hardships with a recursive loop.
I actually use some bash node to externally process some molecules, and for some of them the node fails, thus interrupting the workflow.

I successfully catched the error for the first problematic molecule, but now I would like to automatise this step by using a recursive loop, such as 'try to process molecules while there are molecules in the input table'.

My problem is that I use a reference row filter to make sure I don't process the same molecule twice, which works except for the last row.

Indeed, the last row can be empty so I use an empty table switch, in which I define a variable (java edit variable) to end the recursive loop end before that happens.

All of this works fine except that the value of the variable "end loop" stays "false" even when it is in the empty branch where it should become "true".
The value "true" is actually given to the variable within the branch, but becomes "false" in the End IF node.

Any idea why this happens and how I fix this?

Thank you for your help!

Jose Manuel

Dear KNIME communauty,

I actually could find an ugly solution for now:

Create a new column within the Empty table Switch which states whether the table is empty or not and export it to a variable.
Still, I am pretty sure there are better ways than this...

Any idea? :)

Jose Manuel

Hi Jose,

I suppose the problem is that the Empty Table Switch only does have one variable outport. You could try to append a Cache node after each port of the empty table switch, then connect java edit variables and string manipulation to the cache node.

--- Edit---

Yes my guess was correct. As you see in the workflow attached, there is an additional Cache needed before the Edit Variable.

 

Cheers, Iris

Hi Iris, 

thank you for your suggestion!

I believe that using cache nodes is not the best solution, since, as I understood it, it will copy the whole table on the disk.
I rather added a column to the table, which can then be read directly outside the END IF node to adapt the behavior of the workflow.

Cheers, 
Jose Manuel

Correct, the cache node will copy the table (which is sometimes required to allow faster data-scans downstream).

If you wanted to avoid it you could also use, e.g. a column filter node with unmodified default-settings (= include all columns). Still an ugly workaround as you don't do any column filtering really but it avoids the table duplication. Column filtering is a cheap operation.

I guess Iris' comment on the missing variable port in the empty table switch is very valid. We should add such a node (one table inport, two variable outports). We'll open a feature request.

Thanks,
  Bernd
 

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