# Java filter

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

![Transformation using the Java filter step](/files/q1clx1PoD75FiOdzWqnv)

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.

The condition used in this sample transformation is:

```
if( condition)
{matching step}

else
{non-matching step}
```

### Step name

* **Step name**: Specifies the unique name of the step on the canvas. Default: `Java filter`.

### Options

![](/files/GdYvKBOWsp82OQ21hyRs)

| Option                                                | Description                                                                                                                   |
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Destination step for matching rows (optional)**     | Specify the name of the step to receive rows evaluated as matching by **Condition (Java expression)**.                        |
| **Destination step for non-matching rows (optional)** | Specify the name of the step to receive rows evaluated as non-matching by **Condition (Java expression)**.                    |
| **Condition (Java expression)**                       | Specify a Java expression for filtering the data. See [Filter expression examples](#filter-expression-examples) for examples. |

### Filter expression examples

The following examples show Java expressions that you can use in **Condition (Java expression)**:

* Filters a string that contains whitespace:

  ```
  .contains(" ");
  ```
* Filters a string that is identical to a constant string:

  ```
  .equals("Positive");
  ```
* Filters a Boolean value:

  ```
  Boolean,TRUE
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/java-filter-pdi-step.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
