One Star

Can tJavaFlex create output rows at End Code section?

I am new to Talend. I need to create a special transformation for input and output rows that can not match one to one. I wonder if I can use tJavaFlex:
Main Code:
Collect data from input_rows

End Code:
Perform special transformation (third party library) on data collected at Main Code
Dump output into output_rows
Is there a function like generateRow() that I can call in the End Code segment:
output_row.col1 = val1
output_row.col2 = val2
generateRow() // create an output row
If answer is no, is there an another way.
Thank in advance.
Community Manager

Re: Can tJavaFlex create output rows at End Code section?

I want to know do you want to perform special transformation on each row or all the rows?
if each row, you should use tJavaRow component.
if all rows, the tJavaFlex is the proper one.
Assuming you are using tJavaFlex, at the end code of tJavaFlex, set the result to a global variable after you finish the special transformation on data collected, for example:
globalMap.put("key", result);
on next subjob, using a tFixedFlowInput to generate one row, add one field on schema, let's called line.
lineSmiley SadString)globalMap.get("key")
lineSmiley SadInteger)globalMap.get("key") // it depends on the data type of result.
Best regards
Talend | Data Agility for Modern Business
One Star

Re: Can tJavaFlex create output rows at End Code section?

The transformation has to be perform on all the rows. The third party library is a plotting tool to create interpolation points for input data set. I will try to use globalMap to on 2 tJavaFlex instead of one. Thanks.