using getFlowVariable in Java Edit Variable for integer variables


I'm trying to get edit a flow variable which may or may not be present. I am using an Edit Flow Variable node, and using getFlowVariable() method. This works for string variables, but I am having trouble with integer variable. It comes back with a "An error occured in an expression wiht output flow variables."

I tired different ways to see how this may work, initially using 

Integer i = getFlowVariable("name","tInt");

this created an error that the ype between getFlowVariable() and i is wrong, so I switched to try

String s = getFlowVariable("name","tInt");

This is accepting by the node, but fails to run. I then tried


String s = getFlowVariable("name","tString");

and this didn't work either.

How can I get a flow variable by name for an integer variable?




I have to admit the description of the Java Edit Variable node is a tad unclear. Anyway this works for me:

int i = 0;
i = getFlowVariable("name", i);

also with String or double, provided the output type is also set accordingly.


Hi Marco

I see, so the type is a variable of the type, not a string of the type. Could the description be corrected, especially where it says the types are tString, tInt, and tDouble?

Thanks for your help.



That would indeed be a good suggestion for the folks at KNIME! :-)

I am sure they will read this and adjust the description of the node to make it clearer.


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