Filtering rows by using the Java Filter step

As an alternative to the Filter rows step, there is another step for the same purpose: the Java Filter step. This step is useful when your conditions are too complicated and it becomes difficult or impossible to create them in a regular Filter rows step.

With the Java Filter step, instead of creating the condition interactively, you write a Java expression that evaluates to true or false. Look at the last example in the previous section:

 (    word CONTAINS geo AND     len_word>8    ) OR    (word in list earth; rocks) 

The same condition can be expressed with a Java expression as (word.matches(".*geo.*") && word_length>8) || word.equals("earth") || word.equals("rocks").

Following is how you implement this ...

Get Learning Pentaho Data Integration 8 CE - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.