Added by Matt Casters, last edited by Jens Bleuel on Mar 23, 2009  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Description

The Filter rows step allows you to filter rows based on conditions and comparisons. Once this step is connected to a previous step (one or more and receiving input), you can click on the "<field>", "=" and "<value>" areas to construct a condition. Click the Add condition icon to add conditions.

Add condition converts the original condition to a sub-condition and adds a new condition. Click a sub-condition to edit it (go down one level into the condition tree).

Note: To enter an IN LIST operator, use a string value separated by semicolons. This also works on numeric values like Integers. But always, the list of values must be entered with a string type, e.g.: 2;3;7;8

Options

Option Description
Step name Name of the step; this name has to be unique in a single transformation.
Send 'true' data to step The rows for which the condition specified is true are sent to this step
Send 'false' data to step The rows for which the condition specified are false are sent to this step
The Condition Click the 'NOT' button in the upper left to negate the condition.
Click on the <Field> buttons to select from a list of fields from the input stream(s) to build your condition(s).
Click on the <value> button to enter a specific value into your condition(s).
To delete a condition, right-click and select Delete Condition
Add Condition button Click to add a condition

It is not clear from the above description how to filter rows based on values from variables. (If at all possible)

Comment: Posted by Maor at Oct 19, 2009 07:19

Maor:

The filter rows step detects only fields in the input stream.

So, if you want to filter rows based in a variable value, you can modify the previous step (a table input for example) and include the variable as another field, like:

${myvar}=5

A query:

SELECT field1,
field2,
${myvar} AS field3 
FROM table
WHERE field1=xxxx


Then in the filter row condition, you can have

field1 = field3

Hope that helps!

Luis

Comment: Posted by Luis Carraud at Nov 12, 2009 14:15

Thanks Luis! It works.

For others to know, instead of the Table Input trick above you can use the simple "Get Variables" step to set parameters in fields.

Comment: Posted by Maor at Nov 16, 2009 10:20

Considering PDI's data-flow options (Copy or Distribute rows), I believe it should be mentioned if both work the same for Filter Rows, or if one is better than the other.

Comment: Posted by Renato Back at Jul 14, 2010 09:47

Do we have an option to check if a field has a NULL value?
The value option does not have an option to do that.

Comment: Posted by om at Jul 23, 2010 14:54

@om,

It is easy to check for a null value.  Just use the "IS NULL" or "IS NOT NULL" operators available in the drop down list instead of "="

Comment: Posted by Jon Roberts at Jul 24, 2010 08:00