Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a task where I'm given data that I need to populate from a previous record with the same unique ID.
It looks something like this:
Customer ID | Name | Address 1 | Address 2 | Purchase Date | Shop Address
1000 | Bob Smith | 123 Main St | Somewhere HI 12345 | 01/01/2020 | 111 Shop rd
1000 ||||03/01/2020| 123 Market Hw
2000 | Rachel Smith | 824 Open Rd | Beverly Hills CA 01879 | 04/01/2020 | 111 Shop Rd
3000 | Justin T | ...
The first time a new ID shows up we should have all the data. For the subsequent rows we only have the new data, everything omitted is assumed to be repeating and I need to populate it from the previous row as long as the Customer ID matches to the current line.
My expected outcome from the use case is as follows:
1000 | Bob Smith | 123 Main St | Somewhere HI 12345 | 01/01/2020 | 111 Shop rd
1000 | Bob Smith | 123 Main St | Somewhere HI 12345 | 03/01/2020| 123 Market Hw
2000 | Rachel Smith | 824 Open Rd | Beverly Hills CA 01879 | 04/01/2020 | 111 Shop Rd
3000 | ...
If there's a component that will allow me to do this with many fields I'd prefer that over java code using variables, I have around 30 fields that I'll need to utilize this solution for.
Hi
I think tMemorizeRow component can meet your need, please refer to the component documentation and learn this component. Here I show you an example on tMap.
data source input-main--tMemorizeRow_1---tMap....>
Regards
Shong
Hi
I think tMemorizeRow component can meet your need, please refer to the component documentation and learn this component. Here I show you an example on tMap.
data source input-main--tMemorizeRow_1---tMap....>
Regards
Shong
Hello,
As you have mentioned you want the solution without using custom code, you can do this in a tMap via if else expression.
https://community.talend.com/s/article/tMap-expression-syntax-TCiHW
Here is also a tMemorizeRows component which memorizes group key and columns on the previous row.
Best regards
Sabrina
Thanks @Shicong Hong and @Xiaodi Shi. I'm not sure how to mark the topic as resolved but that's the solution I was looking for