Skip to main content
Pentaho Documentation

Java filter

Parent article

The Java filter step refines a transformation data stream using a Java expression to set up conditional processing.

Transformation using the Java filter step

As shown in the sample transformation above, the output stream from the Data grid step is processed by the Java filter step. Based on the specified condition, the Java filter step sends matching data to the true step and non-matching data to the false step. Below is the condition used in this sample transformation.

if( condition)
{matching step}

else
{non-matching step}

General

Enter the following information in the transformation step name field.

  • Step Name: Specifies the unique name of the transformation step on the canvas. The Step Name is set to Java filter by default.

Options

The Java filter step includes the following settings:

OptionDescription
Destination step for matching rows (optional)Specify the name of the step to receive rows evaluated as matching by the Condition (Java expression) option.
Destination step for non-matching rows (optional)Specify the name of the step to receive rows evaluated as non-matching by the Condition (Java expression) option.
Condition (Java expression)Specify a Java expression for filtering the data. See Filter expression examples for code samples.

Filter expression examples

Below are examples of Java expressions that you can use to filter data in the Condition (Java expression) option.

  • Filters a string that contains white space:
    .contains(" ");
  • Filters a string that is identical to a constant string:
    .equals("Positive");
  • Filters a Boolean value:
    Boolean,TRUE