[tJavaRow] Copy all properties from input_row to output_row

Five Stars

[tJavaRow] Copy all properties from input_row to output_row

I tried to search a solution in the forum but with no luck. There is a simple way to copy all the proprerties from input_row to output_row without doing it property by property? Something like in the perl examples where they write something like @output = @input and then they process only the properties of interest directly on the output data.
Thank you very much, Stefano.
One Star

Re: [tJavaRow] Copy all properties from input_row to output_row

do you have any examples of what you are trying to accomplish?
Five Stars

Re: [tJavaRow] Copy all properties from input_row to output_row

do you have any examples of what you are trying to accomplish?

Very simple: I'm importing a excel file with 10's columns in a db. I created the schema but ONE column need to be processed and modified based on a set of conditions (a set of if-elseif). So (condier I'm a newbie of Talend) I added a tJavaRow to code with java the set of if. But the row which I get at output are all empty.
I noted that if I write someting like output_row.fieldname = input_row.fieldname for the fields other the one I'm processing, they appear on the output. So I wonder if I have to write all such assignement for all the columns. If possible I want to avoid this coding: it's long and very "hard coded", so a change in the schema (you know... software is everything than stable) needs a relative change in the java code.
Just I note: I see the tMap component, but it seems not the right choose for this set of if.
I'm doing in the wrong way?
Thank you, Stefano.
One Star

Re: [tJavaRow] Copy all properties from input_row to output_row

What exactly are you trying to do to the one column? If you use the tMap and write your own custom routne you should be able to use use the tMap and have your field run through your code as well. In the tMap then you can map the rest of the fields like normal, however use an expression when mapping the field that needs to be modified, in that expressions do something like row.fieldName = MyCode.fucntion(row.fieldName)
One Star

Re: [tJavaRow] Copy all properties from input_row to output_row

Hi,
Please, I do not really understand the function input_row.
What are its properties.
Thank you
One Star

Re: [tJavaRow] Copy all properties from input_row to output_row

If someone is still interested, I suggest using the tJavaFlex component with the Auto Propagation option selected, and to put your code in the Main Code section. It works perfectly like this.
Cheers,

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download