Sometimes, we have to filter our source data based on the some advance conditions in the data processing to populate multiple outputs. It is very easy task if you are using Talend Open Studio which has a lot of rich data processing components and you can pass multiple logical conditions as well.
We are here to tell you "How to Filtering data source based on advanced conditions by using tFilterRow?" in Talend Open Studio.
We are here to tell you "How to Filtering data source based on advanced conditions by using tFilterRow?" in Talend Open Studio.
tFilterRow processing component filters input rows by setting one or more conditions on the selected columns. It helps parametrizing filters on the source data. It uses a logical operator to combine simple conditions and to combine the filter results of both modes if any advanced conditions are defined.
Based on the logical operator selected, the conditions are evaluated one after the other in sequential order for each row. When evaluated, each condition returns the Boolean value of true or false.
Input column: Select the column of the schema the function is to be operated on
Function: Select the function on the list
Operator: Select the operator to bind the input column with the value
Value: Type in the filtered value, between quotes if needed.
Warning - In the Value field, you must type in your values between double quotes for all types of values, except for integer values, which do not need quotes.
Example - We want to separate players for "Tennis" and "Cricket" based in Games column as given below:
Warning - In the Value field, you must type in your values between double quotes for all types of values, except for integer values, which do not need quotes.
Example - We want to separate players for "Tennis" and "Cricket" based in Games column as given below:
Id
|
FirstName
|
LastName
|
Games
|
1
|
Ryan
|
Arjun
|
Baseball
|
1
|
Ryan
|
Arjun
|
Table Tennis
|
1
|
Ryan
|
Arjun
|
Cricket
|
1
|
Ryan
|
Arjun
|
Tennis
|
2
|
Kimmy
|
Wang
|
Cricket
|
2
|
Kimmy
|
Wang
|
Tennis
|
2
|
Kimmy
|
Wang
|
Basketball
|
2
|
Kimmy
|
Wang
|
Hockey
|
3
|
Rosy
|
Gray
|
Badminton
|
3
|
Rosy
|
Gray
|
Volleyball
|
3
|
Rosy
|
Gray
|
Soccer
|
4
|
Will
|
Smith
|
Tennis
|
4
|
Will
|
Smith
|
Basketball
|
4
|
Will
|
Smith
|
Volleyball
|
4
|
Will
|
Smith
|
Soccer
|
5
|
John
|
Godson
|
Swimming
|
5
|
John
|
Godson
|
Volleyball
|
5
|
John
|
Godson
|
Soccer
|
We will use tFileInputDelimated, tFilterRow and tLogRow from the Palette onto the design workspace.
Process flow -
- On the tFileInputDelimited Basic settings panel, set the filepath to the file to be denormalized and define the Row and Field separators, the Header and other information if required.
- Now, connect the tFileInputDelimited to the tLogRow, using a Row > Filter link and rename it as Source Data.
- Double-click tFilterRow to display its Basic settings view and define its properties. In the Conditions table, add four conditions and fill in the filtering parameters. From the InputColumn list field of the first row, select Games, from the Function list field, select Lower case, from the Operator list field, select Equals, and in the Value column, type in "tennis".
- Now, connect the tFilterRow to the tLogRow, using a Row > Filter link and rename it as Filter. Then again drop tLogRow from the Palette into the design workspace and rename it as Reject and then again connect the tFilterRow to the reject, using a Row > Reject link.
Each rejected record has a corresponding error message that explains the reason of rejection.
To Learn more, please visit our YouTube channel at -
To Learn more, please visit our Instagram account at -
To Learn more, please visit our twitter account at -
YouTube demo example-