One Star

Multiple Inputs to single output column in tmap

To help explain my problem I have created an example project in Talend (see attached pictures).
This project has 3 sets of input data (in excel form). One is a file containing information about production parameters for producing various products on a specific date. The other two files can be thought of as quality control sheets for the 2 products made on this date.
Products are all given a unique number, and this number has been used to join the QC sheets to the Production Parameter details sheet. I want to combine all of these sheets into one table in a database. The columns from the QC sheets should be appended together based on the product number.
When I try to run the project as shown in the images, I receive the following error messages:
________________________________________
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
row2.Product_Id.Product_Id cannot be resolved or is not a field
Syntax error on token "row3", delete this token
row2.Weight.Weight cannot be resolved or is not a field
Syntax error on token "row3", delete this token
row2.Pass_QC.Pass_QC cannot be resolved or is not a field
Syntax error on token "row3", delete this token
at cymat_production_parameters_db.test_0_1.Test.tFileInputExcel_1Process(Test.java:1281)
at cymat_production_parameters_db.test_0_1.Test.runJobInTOS(Test.java:2570)
at cymat_production_parameters_db.test_0_1.Test.main(Test.java:2485)
________________________________________
What do I need to put in the expression editor for the output table to solve this problem?
6 REPLIES
One Star Krp
One Star

Re: Multiple Inputs to single output column in tmap

You just have to put a '+' between "row2.weight" and "row3.weight".
And for the Product_ID, since you use an Inner Join, you only need row2.Product_ID without row3.Product_ID.
Isn't it ?
One Star

Re: Multiple Inputs to single output column in tmap

I did as you suggested and it has seemed to work. However, although the project ran with no errors, none of the data is being transferred to MySQL (see picture).
One Star

Re: Multiple Inputs to single output column in tmap

You have row2 & row3 both defined as inner joins with unique match. This means that your product num must be present in BOTH files before your main row will "pass through" the tMap. As you can see from your files and your test run, that will never happen.
I would uncheck your inner join boxes and see if what you get is what you want.
One Star

Re: Multiple Inputs to single output column in tmap

Thanks SMaz, your suggestion made a definite improvement.
However, my output is not exactly as I expected. It works fine for Weight because it is an Integer, but for a string the expression:
row2.Product_Id + row3.Product_Id
Results in nullProduct1 when QC2 has no value and Product2null when QC1 has no value. Any idea how to fix this?
Picture attached.
One Star

Re: Multiple Inputs to single output column in tmap

I solved the null problem using the Ereplace function. Is this the best way to do it, or is there another way to take care of it?
One Star

Re: Multiple Inputs to single output column in tmap

I'd use an "If" statement for the expression that generates the Product_Id column. In Java it's like this:
row2.Product_Id==null?row3.Product_Id:row2.Product_Id