The following node is available in the Open Source KNIME predictive analytics and data mining platform version 2.7.1. Discover over 1000 other nodes, as well as enterprise functionality at http://knime.com.

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

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.

Ports

Input Ports
0 Input variables (optional).
Output Ports
0 Output variables.
This node is contained in KNIME Java Snippet Nodes (draft) provided by KNIME GmbH, Konstanz, Germany.