Java Edit Variable
Edit or add flow variables using java code. The node is analogous to
the Java Snippet node: In the central panel, added java code
to add or modify variables. The variables available
at the input are listed on the left.
It is also possible to use external java libraries (that is,
libraries that are not part of java boot classpath). In order to
include such external jar or zip files, add their location in the
"Additional Libraries" tab using the control buttons.
You can define reusable templates with the "Create templates..."
button. Templates are stored in the
users workspace by default and can be accessed via the "Templates"
tab.
Dialog Options
- Flow Variable List
-
The list contains the flow variables that are currently available at
the node input. Double clicking any of the entries will insert the
respective identifier at the current cursor position (replacing the
selection, if any).
- Snippet text area
-
Enter your java code here. You can access input flow
variables by defining them in the Snippet fields for input. A
second way is to use the method getFlowVariable(name, type)
where name is the name of the flow variable, respectively.
You can use the following values for the type parameter.
tString : String
tInt : Integer
tDouble : Double
Java Snippet Methods:
getFlowVariable(name, type) : Get value of a flow variable by name
getFlowVariables(type) : Get all flow variables by type. A name to value map is returned.
flowVariableExists(name) : Check if a flow variable with given name exists
isFlowVariableOfType(name, type) : Check if a flow variable is of type
You can hit ctrl+space to get an auto completion box with all
available classes, methods and fields. When you select a class and hit
enter a import statement will be generated if missing.
Note, that the snippet allows defining custom global variables and
custom imports.
Exceptions in the snippet are caught by the framework and will
cause the execution to fail. If you want to stop execution, please use an
exception of class Abort. It gives the user a nice
error message.
- Input
-
Define system input fields for the snippet text area. Every field
represents a flow variable of the input.
- Output
-
Define flow variables that will be added to stack of flow variables
at the output. Every row in the Output table
defines a java field bound to a flow variable. Values assigned to this field
in the snippet will set the value of the flow variable at the output.
- Run only on execution
-
If unselected, the snippet is run as soon as the node is configured (default). If selected, the snippet is
run only once when the node is being executed (going from yellow to green state). In this case variables
are populated later, often causing downstream nodes to be not configurable as the created variables have a
meaningless default value. However, sometimes this is necessary when for instance the snippet involves
heavy computation, network access or other type of I/O. If unsure, leave unselected.
Ports
Input Ports
0 |
Input variables (optional). |
This node is contained in KNIME Java Snippet Nodes
provided by KNIME GmbH, Konstanz, Germany.