You are on page 1of 21

Talend Tutorials & Scenarios Prepared by Venkat Rathnam Tekuri

how to find out the Second Maximum Value record in Talend.


Source:
EMPNO,ENAME,JOB,SAL,DEPTNO
101,VENKAT,SSE,2000,10
102,RATHNAM,TL,3000,20
103,TEKURI,MANAGER,1000,30
104,TEKUR,MANAGE,5000,30
105,TEKU,MANAG,6000,20
106,VENKAT,SSE,8000,10
110,VENKA,SS,8000,10
107,RATHNAM,TL,7000,10
108,TEKURI,MANAGER,9000,20
Target:
| tLogRow_1 |
|=----+------+---+----+-----=|
|EMPNO|ENAME |JOB|SAL |DEPTNO|
|=----+------+---+----+-----=|
|106 |VENKAT|SSE|8000|10 |
'-----+------+---+----+------'
Procedure:
 Drag and Drop source Metadata tFileInputDelimited component,
tSortRow,tSampleRow, and tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the tFileInputDelimited and verify the properties.

 Double click the tSortRow and define the sort key as SAL as desc.

 Double click tSampleRow and define the Range as “2”


 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

How to find out the Second Maximum Value records in Talend.


Source:
EMPNO,ENAME,JOB,SAL,DEPTNO
101,VENKAT,SSE,2000,10
111,TEKURI,MANAGER,9000,20
102,RATHNAM,TL,3000,20
103,TEKURI,MANAGER,1000,30
110,VENKA,SS,8000,10
104,TEKUR,MANAGE,5000,30
105,TEKU,MANAG,6000,20
106,VENKAT,SSE,8000,10
107,RATHNAM,TL,7000,10
108,TEKURI,MANAGER,9000,20
113,VENKAT,SSE,8000,10
Target:
.-----+------+---+----+------.
| tLogRow_1 |
|=----+------+---+----+-----=|
|EMPNO|ENAME |JOB|SAL |DEPTNO|
|=----+------+---+----+-----=|
|110 |VENKA |SS |8000|10 |
|106 |VENKAT|SSE|8000|10 |
|113 |VENKAT|SSE|8000|10 |
'-----+------+---+----+------'
Procedure:

 Drag and Drop source Metadata tFileInputDelimited component,


tSortRow,tUniqRow,tSampleRow, tMap,tFileInputDelimited and tLogRow
Components.
 Connect them together by using Row > Main link.
 Double click the tFileInputDelimited and verify the properties.

 Double click the tSortRow and define the key as sal desc

 Double click the tUniqRow and define the sal as key.


 Double click the tSampleRow component and define the Range as “2”.

 Double click the tFileInputDelimited and take the same source

 Double click the tMap component and Define the INNER JOIN with ALL Matching
records and commn key column as SAL.
 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

how to find Skip the last 5 records and load the remaining records in Talend.
Source:
EMPNO,ENAME,JOB,SAL,COMM,DEPTNO
101,VENKAT,SE,5000,500,10
102,RATHNAM,SSE,6000,600,10
104,TEKURI,JL,4000,400,20
103,VENKI,TL,9000,900,50
105,VENKATA,MANAGER,10000,100,50
106,RATHNA,ASC,20000,2000,50
101,VENKAT,SE,5000,500,10
102,RATHNAM,SSE,6000,600,10
104,TEKURI,JL,4000,400,20
103,VENKI,TL,9000,900,50
105,VENKATA,MANAGER,10000,100,50
106,RATHNA,ASC,20000,2000,50
101,VENKAT,SE,5000,500,10
102,RATHNAM,SSE,6000,600,10
104,TEKURI,JL,4000,400,20
103,VENKI,TL,9000,900,50
105,VENKATA,MANAGER,10000,100,50
106,RATHNA,ASC,20000,2000,50
101,VENKAT,SE,5000,500,10
102,RATHNAM,SSE,6000,600,10
104,TEKURI,JL,4000,400,20
103,VENKI,TL,9000,900,50
105,VENKATA,MANAGER,10000,100,50
106,RATHNA,ASC,20000,2000,50
101,VENKAT,SE,5000,500,10
102,RATHNAM,SSE,6000,600,10
104,TEKURI,JL,4000,400,20
103,VENKI,TL,9000,900,50
105,VENKATA,MANAGER,10000,100,50
106,RATHNA,ASC,20000,2000,50
101,VENKAT,SE,5000,500,10

Target:
.-----+-------+-------+-----+----+------+-------.
| tLogRow_2 |
|=----+-------+-------+-----+----+------+------=|
|EMPNO|ENAME |JOB |SAL |COMM|DEPTNO|NUM_SEQ|
|=----+-------+-------+-----+----+------+------=|
|104 |TEKURI |JL |4000 |400 |20 |21 |
|102 |RATHNAM|SSE |6000 |600 |10 |20 |
|101 |VENKAT |SE |5000 |500 |10 |19 |
|106 |RATHNA |ASC |20000|2000|50 |18 |
|105 |VENKATA|MANAGER|10000|100 |50 |17 |
|103 |VENKI |TL |9000 |900 |50 |16 |
|104 |TEKURI |JL |4000 |400 |20 |15 |
|102 |RATHNAM|SSE |6000 |600 |10 |14 |
|101 |VENKAT |SE |5000 |500 |10 |13 |
|106 |RATHNA |ASC |20000|2000|50 |12 |
|105 |VENKATA|MANAGER|10000|100 |50 |11 |
|103 |VENKI |TL |9000 |900 |50 |10 |
|104 |TEKURI |JL |4000 |400 |20 |9 |
|102 |RATHNAM|SSE |6000 |600 |10 |8 |
|101 |VENKAT |SE |5000 |500 |10 |7 |
|106 |RATHNA |ASC |20000|2000|50 |6 |
|105 |VENKATA|MANAGER|10000|100 |50 |5 |
|103 |VENKI |TL |9000 |900 |50 |4 |
|104 |TEKURI |JL |4000 |400 |20 |3 |
|102 |RATHNAM|SSE |6000 |600 |10 |2 |
|101 |VENKAT |SE |5000 |500 |10 |1 |
'-----+-------+-------+-----+----+------+-------'

Procedure:
 Drag and Drop source Metadata tFileInputDelimited ,tMap, tSortRow,tSampleRow,
and tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the tFileInputDelimited and verify the properties.

 Double click the tMap and create NUM_SEQ


 Double click the tSortRow and define the Key as NUM_SEQ as desc.

 Double click the tSampleRow and Define the range “6..2000”

 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

how to find For the below sources below output.


Source:
SRC_LOC1.txt
ID,LOC
101,HYD
102,
103,MB

SRC_LOC2.txt
ID,LOC
103,
101,CHE
102,BAN

Target:
.---+-------.
| tLogRow_2 |
|=--+------=|
|ID |LOC |
|=--+------=|
|101|HYD|CHE|
|102| |BAN |
|103|MB| |
'---+-------'
Procedure:
 Drag and Drop the TFileList, source Metadata tFileInputDelimited ,tBufferOut,
tBufferInput,tDenormalize and tLogRow Components.
 Connect them together by using Row > Main link as per the above.
 Double click the tFileList and define the properties.

 Double click the tFileInputDelimited and verify the properties.


 Double click the tDenormalize and define the LOC with | Delimited.

How to find out the Crick score maximum score,HALF’s count,100’s count
Source:
NAME,MATCHDATE,SCORE
SACHIN,2020-05-15,152
ROHIT,2020-05-15,50
GAMBEER,2020-05-15,101
YUVARAJ,2020-05-15,102
VIRAT,2020-05-15,50
SACHIN,2020-06-15,50
ROHIT,2020-06-15,52
GAMBEER,2020-06-15,100
YUVARAJ,2020-06-15,100
VIRAT,2020-06-15,100
SACHIN,2020-07-15,100
ROHIT,2020-07-15,50
GAMBEER,2020-07-15,101
YUVARAJ,2020-07-15,50
VIRAT,2020-07-15,50
SACHIN,2020-04-15,100
ROHIT,2020-05-14,100
GAMBEER,2020-04-15,50
YUVARAJ,2020-04-15,50
VIRAT,2020-04-15,59

Target:
Starting job TVR_CRICKET_SCORE at 17:40 22/08/2020.
[statistics] connecting to socket on port 3657
[statistics] connected
.-------+--------.
| tLogRow_1 |
|=------+-------=|
|NAME |MAXSCORE|
|=------+-------=|
|SACHIN |152 |
|YUVARAJ|102 |
|GAMBEER|101 |
|ROHIT |100 |
|VIRAT |100 |
'-------+--------'

.-------+-------------.
| tLogRow_2 |
|=------+------------=|
|NAME |SCORE_COUNT50|
|=------+------------=|
|SACHIN |1 |
|YUVARAJ|2 |
|GAMBEER|1 |
|ROHIT |2 |
|VIRAT |2 |
'-------+-------------'

.-------+--------------.
| tLogRow_3 |
|=------+-------------=|
|NAME |SCORE_COUNT100|
|=------+-------------=|
|YUVARAJ|1 |
|SACHIN |2 |
|GAMBEER|1 |
|ROHIT |1 |
|VIRAT |1 |
'-------+--------------'

.-------+--------+-------------+--------------.
| tLogRow_4 |
|=------+--------+-------------+-------------=|
|NAME |MAXSCORE|SCORE_COUNT50|SCORE_COUNT100|
|=------+--------+-------------+-------------=|
|SACHIN |152 |1 |2 |
|YUVARAJ|102 |2 |1 |
|GAMBEER|101 |1 |1 |
|ROHIT |100 |2 |1 |
|VIRAT |100 |2 |1 |
'-------+--------+-------------+--------------'

[statistics] disconnected

Job TVR_CRICKET_SCORE ended at 17:40 22/08/2020. [Exit code = 0]


Procedure:

 Drag and Drop the source Metadata


tFileInputDelimited,tAggregateRow1 ,tHashOutput1.
 Drag and Drop the source Metadata
tFileInputDelimited,tFilterRow,tAggregateRow2 ,tHashOutput2.
 Drag and Drop the source Metadata
tFileInputDelimited,tFilterRow,tAggregateRow3 ,tHashOutput3.
 Drag and drop three tHashInput and tMap and tLogRow.
 Define the links as per the above.
 Double click the tFileInputDelimited1 and define the properties.
 Double click the tAggregateRow and define the Group by as NAME and MAXSCORE .

 Define the tHashOutput1.

 Double click the tFileInputDelimited2 and define the properties.


 Double click the tFilterRow and define the condition as SCORE equals 50.

 Double click the tAggregateRow find out the group by as NAME and 50’s count as per
the below.
 Define the tHashOutput2.

 Double click the tFileInputDelimited3 and define the properties.


 Double click the tFilterRow and define the condition as SCORE equals 100.
 Double click the tAggregateRow find out the group by as NAME and 100’s count as per
the below.

 Define the tHashOutput.


 Take there tHashInputs and define the Links .
 Double click the tMap and define the as per the below.

 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

You might also like