I have a table like
Now, I want the output to be like:
surr_key, item_id,item_name, parent_id
Here, surr_key is auto_increment and parent_id is the surr_key of precious row for the same item_id.
a is the first item for item_id=1 thus it will be -1 and same with x.
Can anyone help how to achieve it ?
This post answers a slightly different question, but you can use the method to do what you want. Essentially you are looking at the functionality which means that tMap variables are actioned in order from top to bottom and they preserve their values between rows.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema
Pick up some tips and tricks with Context Variables