Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
SSV1
Contributor
Contributor

Create new row in processing using previous rows data.

Dear Talend Community,

Good day.

Have a requirement to create a new row in my processing and use the records from previous rows input for the new row.

Input:

Column1 Column2

A remaining A

A unused A

Output:

 

Column1 Column2

A remaining A

A unused A

A remaining A|unusedA

 

Could you help on this.

ThankYou,

Sakthi

Labels (4)
3 Replies
veeaar
Contributor
Contributor

is the input and output shown above is in right format?

i am not clear on issue you mentioned but maintaining current and previous values can be achieved with below.

 

veeaar
Contributor
Contributor

in the variables take first variable as prev_variable and second as cur_variable

assign your source input to cur_variable and then Var.cur_variable to the prev_variable.

 

now you can map both your prev_variable nd cur_variable to the target.

for the first run prev_variable will be null and cur_variable will have value and for second run you will see the value in cur_variable moved to prev_variable and then new value in cur_variable

SSV1
Contributor
Contributor
Author

Hi veeaar,

 

Thank you for the response.

 

Apologies. Should have made it little bit detailed. Below is the detailed info. Not sure how to make two rows in to one and keep on merging.

 

Input:

 

Col1 Col2 Col3 Col4

A remaining A. 5 20

A. unused A 1 -8

A remaining A 3 5

A unused A 5 -15

 

Step1 Output: (Merge two columns using col1 same category and deduct (5-1)=4 and

sum(20,-8)=12

 

Col1 Col2 Col3 Col4

A out1 4 12

A remaining A 3 5

A unused A 5 -15

 

This step repeats until one single row. Input might have any number of rows.

 

Please let me know if you need more info.

 

ThankYou,

Sakthi