Insert a Flow Variable in the Global Variable Declaration field (Java Snippet (simple) node)

Hi,

It seems that I can’t insert a Flow Variable as a Global Variable in this type of node.

Whenever I double click in it’s name (from the Flow Variable List) it shows up in the Method Body. If I copy and paste that in the Gloval Variable Declaration Filed, I get the following error:

I highlighted the part in which I inserted the variable.
In case it’s not clear enough, the variable is called “FechaHoy” (it’s a workflow variable) and KNIME “translates” it into the code as $${SFechaHoy}$$ . It’s a string with the following format: “yyyy-mm-dd” (it’s intended to be turned into a LocalDate object).

How can I manage to use my variable in the highlighted line?

Cheers

Apparently it’s just not possible. I just cut and paste that line in the Method Body.
I think this means that the variable will be declared on each iteration (one for each row), which is not precisely optimal.

Did you try using the new Java Snippet as well?

(It is actually the rewritten version of the simple one. We just had so many people liking the simple version, that we decided to keep both)

1 Like

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