how to capture last row

One Star

how to capture last row

I have a Talend job that generates sequence values. So for each row, the value of the column "key" increments 1, 2, 3, 4,... n.
I need to capture the last value (n) and store it in a database table. What is the best way to do that?
In Kettle you would use the Blocking step for this.
Thanks
Geoffrey
Community Manager

Re: how to capture last row

Hello
Define a context var, let's calle it: lastValue, add a tJavaRow in your job and type in, for example:
output_row.id=input_row.id;
output_row.name=input_row.name;
context.lastValue=context.lastValue+1;
the value of var will add 1 when each row pass on tJavaRow and finally stroe it into db.
Best regards

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

Re: how to capture last row

Hi,
Although this is a very post, I have the same issue. I am trying to transfer an ETL transformation from Spoon to Talend and I am trying to find a workaround to implement what the Blocking Step of Spoon does which is basically it blocks until all rows have been processed and all subsequent steps receive the last input row to this step.

The workaround with introducing the lastValue variable is a way to count the rows processed but how I can block the execution until all rows have been processed and pass only the last row?
Is there any equivalent step?
Thank you.
One Star

Re: how to capture last row