Page 1 of 1

how to assign next value to the current record

Posted: Tue Dec 30, 2008 1:19 am
by rajendharreddy
Hi,

I need help on the following requirement.

I have input in the following format.

Input
-----

A|B
a|5
b|8
c|17
d|35

I need the output in the following format. I need to load B column data into new column (i.e. C) and push one row above.

Output
-------

A|B|C
a|5|8
b|8|17
c|17|35
d|35|

I know we can get this by using stage variables. I tried but i couldn't complete.

Can anybody help me on the same.

Thanks..

Posted: Tue Dec 30, 2008 1:30 am
by Raghavendra
First sort the data then using a copystage send the rows to two links.

On the first link add a new column (KEY) with generated numbers from 1.
On the second link add another column(KEY) with generated numbers from 0.

Join both the links using generated column (KEY) as a key column. The First Link will be Primary link.

Hope this solves your problem.

Posted: Tue Dec 30, 2008 7:17 am
by Sainath.Srinivasan
You can sort the data in reverse order and use stage variables to get previous rows value.