Java Snippet Row Filter

Java Snippet based Row Filter. Use the java editor to enter a boolean expression that is used to define whether an input row is passed to the output, whereby true defines a match, i.e. the current row is passed to the output. For instance, to filter for every other row, you could use an expression such as

return $$ROWINDEX$$ % 2 == 0;

This node supports missing values. If the corresponding check box is set missing values are represented as null values. If the check box is not set and the snippet accesses a field whose value is missing, the expression evaluates to false (no match). It also evaluates to false in case the snippet throws an exception (other than Abort).

You can halt the entire execution by throwing an Abort exception such as throw new Abort(message);.

Options

Column List
The list contains the column that are available in the input table. Double click any of the column names to insert the respective field in the expression editor. It will replace your current selection or simply insert at the current caret position.
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).
Global Variable Declaration
Define global variables here. These variables are available during the execution and they are also modifiable. Names starting with '_' (underscore) are discouraged due to potential name conflicts with internally used variables.
Method Body
Enter your java code here (the entire source will be wrapped in a method). You can add the name of a variables by double-clicking its name in the left list. Note that numeric (double-compatible) variables will be handled as Double, int-compatible variables as Integer and any other varaible type as String.
Insert Missing As Null
If selected, missing values in the input table will be represented by null in the expression. It is your responsibility to check for null in this case (the fields are all real classes, so even int and double are represented as their respective class Integer and Double). If unselected, a missing value in the relevant input cell will immediately produce a false match.
Compile on close
If unchecked, the syntax test is skipped when the settings are applied to the model, allowing the dialog to close even if there are syntax errors encountered. This enables the user to temporarily close the dialog, investigate the input table and then return to the almost-complete-and-running snippet code in the dialog. The node will not be executable (it will be red) if the code contains syntax errors. This option is only for convenience, it does not have any effect on the output of this node.

Input Ports

Icon
Input data to be split.

Output Ports

Icon
Input data for which the expression evaluated to true.

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.