Search code examples
talend

Returns the value in the next empty rows


Input Here is an example of my input.

Number Date Motore
1 Fri Jan 01 00:00:00 CET 2021 Motore 1
2 Motore 2
3 Motore 3
4 Motore 4
5 Fri Feb 01 00:00:00 CET 2021 Motore 1
6 Motore 2
7 Motore 3
8 Motore 4

Expected Output

Number Date Motore
1 Fri Jan 01 00:00:00 CET 2021 Motore 1
2 Fri Jan 01 00:00:00 CET 2021 Motore 2
3 Fri Jan 01 00:00:00 CET 2021 Motore 3
4 Fri Jan 01 00:00:00 CET 2021 Motore 4
5 Fri Feb 01 00:00:00 CET 2021 Motore 1
6 Fri Feb 01 00:00:00 CET 2021 Motore 2
7 Fri Feb 01 00:00:00 CET 2021 Motore 3
8 Fri Feb 01 00:00:00 CET 2021 Motore 4

I tried to use the TmemorizeRows component but without any result, the second line is valorized but the others are not. Could you kindly help me.


Solution

  • You can solve this with a simple tMap with 2 inner variables (using the "var" array in the middle of the tMap) Create two variables :

    • currentValue : you put in it the value of your input column date (in my example "row1.data").
    • updateValue : check whether currentValue is null or not : if null then you do not modify updateValue field . If not null then you update the field value. This way "updateValue" always contains not null data.

    In output, just use "updateValue" variable.

    enter image description here