Search code examples
talendtalend-mdm

What component can be used to duplicate every row of an excel file using Talend?


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.


Solution

  • Send 2 identical inputs to a tUnite to duplicate the row. Then send the rows to a tSort to sort them.

    enter image description here

    The 2 tFlowInput are identical, replace them with what you have.

    enter image description here

    Sync Columns on the tJoin. Set the columns to sort on the tSort

    enter image description here

    Output :

    .---------+----------+----------+----------.
    |                tLogRow_1                 |
    |=--------+----------+----------+---------=|
    |newColumn|newColumn1|newColumn2|newColumn3|
    |=--------+----------+----------+---------=|
    |val1     |val2      |val3      |val3      |
    |val1     |val2      |val3      |val3      |
    |val5     |val6      |val7      |val8      |
    |val5     |val6      |val7      |val8      |
    '---------+----------+----------+----------'