Flow variables cannot be used as inputs for Components?

Dear Knimers,

Metanodes can take both tables and flowvariables (among other types) as inputs. But this does not seem to be the case for Components. In the example below the Metanode and the Component have the same content:
image
In the metanode everything looks fine:
image
…but in the Component, the input variables are gone and the Java Edit Variable node complains “no such variable”:
image

Is this by design? If yes, what is the philosophy behind it?

See the attached workflow.
tmp2.zip (40.4 KB)

Best,
Aswin

Hi @Aswin -

Here you are likely running into the issue where flow variables are local to components by default. It turns out you can pass variables into and out of components, but you must be explicit about it. (This is not the case for regular metanodes.)

Check out this video, starting at 3:30, for a demonstration of how you can deal with flow variables in components. Prior to KNIME 4.0, we referred to components as “wrapped metanodes”, as shown in the video - but the concepts are still the same.

9 Likes

Thanks @ScottF! I was never a heavy user of wrapped metanodes / components, so the behavior of the a variable input seemed counterintuitive, but now it totally makes sense. I guess the flow variables are now somewhat analogous to function parameters in Java (for example).

2 Likes

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