Reputation: 523
If I have an excel file with rows like this:
val1 | val2 | val3 | val4
val5 | val6 | val7 | val8
then I need the result to be this:
val1 | val2 | val3 | val4
val1 | val2 | val3 | val4
val5 | val6 | val7 | val8
val5 | val6 | val7 | val8
Is this possible with Talend?
EDIT: Notice the order of the rows. I need them to maintain order.
Upvotes: 0
Views: 942
Reputation: 142
For a pure duplication, the easiest would be to use a tHashInput to store the values coming from your Excel file.
Then you can read from a linked tHashOutput twice and join the flows with a tUnite.
If you need to keep the order, you can add a tJavaRow or a tMap before the tHashInput to add a column "order" valued with a sequence. Then you can add a tSortRow after the tUnite and order with the new column. Finally, you delete the extra column with a tFilterColumn (or any other component).
Result :
Code for the order :
Numeric.sequence("s1",1,1);
Note : you might have to add the components tHashOutput and tHashInput to your palette as they are not included by default.
Upvotes: 3
Reputation: 35407
Send 2 identical inputs to a tUnite to duplicate the row. Then send the rows to a tSort to sort them.
The 2 tFlowInput are identical, replace them with what you have.
Sync Columns on the tJoin. Set the columns to sort on the tSort
Output :
.---------+----------+----------+----------.
| tLogRow_1 |
|=--------+----------+----------+---------=|
|newColumn|newColumn1|newColumn2|newColumn3|
|=--------+----------+----------+---------=|
|val1 |val2 |val3 |val3 |
|val1 |val2 |val3 |val3 |
|val5 |val6 |val7 |val8 |
|val5 |val6 |val7 |val8 |
'---------+----------+----------+----------'
Upvotes: 1