Tuesday 7 May 2019

Scinario Based interview Question .....


I have 100 records in my source as a flat file. i want to load the records to target. Target has four table. In the mapping , first record should go to first table , second record will go to second table, 3rd record goes to 3rd table, 4th record goes to 4th table , Again 5th record goes to first table and then Continue the same process . How can u do this?
input File Data:-
ID|FIRSTNAME |LASTNAME |AGE|
|=-+----------+---------+--=|
|1 |Benjamin  |Coolidge |31 |
|2 |Gerald    |Adams    |48 |
|3 |Ulysses   |Grant    |24 |
|4 |Thomas    |Quincy   |2  |
|5 |Theodore  |Wilson   |30 |
|6 |James     |Van Buren|1  |
|7 |Richard   |Grant    |21 |
|8 |Ronald    |McKinley |14 |
|9 |John      |Johnson  |9  |
|10|Rutherford|Quincy   |12 |
Source File :- Tmap:--- generate Sequence Number  
Out Put1:- row1.ID %2==0.5 || row1.ID %4==1
Output2:- row1.ID %4==2
Output3:- row1.ID %2==1.5 ||  row1.ID %4==3
Output4:- row1.ID %4==0
 
.--+---------+---------+---.
|        tLogRow_1         |
|=-+---------+---------+--=|
|ID|FIRSTNAME|LASTNAME |AGE|
|=-+---------+---------+--=|
|1 |Theodore |Van Buren|18 |
|5 |Richard  |Jackson  |40 |
|9 |Andrew   |Johnson  |35 |
'--+---------+---------+---'

.--+---------+--------+---.
|        tLogRow_2        |
|=-+---------+--------+--=|
|ID|FIRSTNAME|LASTNAME|AGE|
|=-+---------+--------+--=|
|2 |Warren   |Taft    |37 |
|6 |James    |Carter  |15 |
|10|Gerald   |Ford    |41 |
'--+---------+--------+---'

.--+---------+---------+---.
|        tLogRow_3         |
|=-+---------+---------+--=|
|ID|FIRSTNAME|LASTNAME |AGE|
|=-+---------+---------+--=|
|3 |Theodore |Roosevelt|40 |
|7 |Harry    |Roosevelt|4  |
'--+---------+---------+---'

.--+---------+---------+---.
|        tLogRow_4         |
|=-+---------+---------+--=|
|ID|FIRSTNAME|LASTNAME |AGE|
|=-+---------+---------+--=|
|4 |Harry    |Jefferson|4  |
|8 |Millard  |Johnson  |35 |
'--+---------+---------+---'

No comments:

Post a Comment

Trigger connections in talend use cases

  Trigger connections define the processing sequence, so no data is handled through these connections. The connection in use will create a d...