Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

pedro
2012-03-13 08:29:34

Hi

You can use this expression.

Code:

row2.value==null?row1.value:(row1.value+row2.value)

Regards,
Pedro

wintersun1981
2012-03-13 08:27:11

Thanks, I found the problem from ur example. Normally we can't add expression like "row1.value+row2.value" as the final result, and assign to the output column of tMap. There is a case that tMap can't find a corresponding record from row2 and thus row2.value would be a null pointer.

pedro
2012-03-13 05:35:44

Hi

Welcome to Talend Community!

According to what you said, I think the job should be like this.

InputComponent(File1)--main-->tMap--out1-->OutputComponent
                                            |
                                      look up
                                            |
                             InputComponent(File2)

For more info, you can follow this tutorial.

Regards,
Pedro

wintersun1981
2012-03-13 04:47:14

Hi, all:
I have two files with the same schema, 2 columns, one is the key and another is a double format column. My target is as follow:
1. Loop all records in file 1,
2. for each record, find a corresponding record in file 2, with the same key.
3. if found, then we now have two records.
4. add the double value in file 2 to the double value in file 1
5. write the double value back to file 1.
6. Process the next record.

I tried tMap and tAggregateRow but failed, could anyone help on this? Which component is the correct choice? thanks!

Board footer

Powered by FluxBB