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 |
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
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.
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.
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.
It is not clear from the above description how to filter rows based on values from variables. (If at all possible)