How to replace null(empty) string values with earlier row's values

One Star

How to replace null(empty) string values with earlier row's values

Hi
I've csv input file with 256 columns. Every two rows have the same EntryID. I need to replace on field in second row from first row example:
Input
RowNumber EntryID TAXRateId
1 1 3
2 1 null
3 2 5
4 2 null
5 3 6
6 3 null
Output after Talend job should look like below:
Output
RowNumber EntryID TAXRateId
1 1 3
2 1 3
3 2 5
4 2 5
5 3 6
6 3 6

Input CSV file have all strings value output also required strings. Input and output file schema have 256 columns.
Any idea how to fast build? Possible only with using tmap?
Thanks in advance for any help
Rafal
Seventeen Stars

Re: How to replace null(empty) string values with earlier row's values

hi
have a look at tMemorizeRows.
hope it helps
regards
laurent
One Star

Re: How to replace null(empty) string values with earlier row's values

kzone Thanks for this info.
I'm trying to use Tmemorizerows and tmap to do this but when I have on tmap this code:
(TAXReclaimCode_tMemorizeRows_1 == null ||
!TAXReclaimCode_tMemorizeRows_1 == null.equals(TAXReclaimCode_tMemorizeRows_1))
? row7.TAXReclaimCode : ""
Talend sending me errors in tmap component.
I'm using string values for this any idea how to fix this.
Kind Regards
Rafal
One Star

Re: How to replace null(empty) string values with earlier row's values

use isnull and not Talend functions.
One Star

Re: How to replace null(empty) string values with earlier row's values

This not working maybe this code is not good?
The main idea is describe in first post how to code this in tmap object?
Thanks in advance
Rafal
One Star

Re: How to replace null(empty) string values with earlier row's values

I think this can also be done with a tMap.
inputfile.xls
\
tMap -->output
/
inputfile.xls
make an inner join on entryId
and filter taxRateID on the first input to not null and on the second input to null
then map fields EntryId and TaxRateId from the first input
and map rowNumber from the second input.