Copy input row to output row with tJavaRow

One Star

Copy input row to output row with tJavaRow

Hey all,
when I do this : output_row = input_row; (much like in perl doing @output_row = @input_row);
I get this error: Type mismatch: cannot convert from load_my_draw.row1Struct to load_my_draw.row2Struct
Is there a way to copy teh complete row from input row to output row?
Ries
Community Manager

Re: Copy input row to output row with tJavaRow

Hello
It is not available in Java now. Can you report a new feature on our bugtracker? In Java, you have to work filed by filed like:
(for example)
output_row.id = input_row.id;

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Copy input row to output row with tJavaRow

there is a readData and writeData on each row so perhaps it's possible to do write a java routine to do something like this
in the tJavaRow
// write data
ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
ObjectOutputStream dos = new ObjectOutputStream(myBytes);
input_row.writeData(dos);

// read data
ByteArrayInputStream myReadBytes =new ByteArrayInputStream(myBytes.toByteArray());
ObjectInputStream dis = new ObjectInputStream(myReadBytes);
output_row.readData(dis);

but i didn't manage to debug it !
One Star

Re: Copy input row to output row with tJavaRow

Hi,
How does it work now? Can we make a complete copy by using output_row=input_row? I try this but it seems I have a conversion problem.
One Star

Re: Copy input row to output row with tJavaRow

Hi,
How does it work now? Can we make a complete copy by using output_row=input_row? I try this but it seems I have a conversion problem.

Same question here. Any hints?