Page 1 of 1

Read Row -1

Posted: Mon Mar 25, 2013 9:46 am
by caltog
Hello,
I want to create a jobs that reads a row from a file in one column and in an other the row-1..

Ex. Data1, Data2
1 Null()
2 1
3 2
... ...

If you have any advice on how to build something like that?
Thanks,

Posted: Mon Mar 25, 2013 10:25 am
by chulett
Sure... but you don't "read row -1". What you can do it hold on to the previous row and then use data from it while processing the current row. End result is the same, just wanted to make that clarification.

Stage variables in a Transformer can do that for you. New versions have more options but this approach is (in my opinion) simpler. Stage variables are evaluated from top to bottom which is key to the technique. I don't have time right now for a Full Wurlod but I'm assuming someone will be along shortly to help. :wink:

Posted: Mon Mar 25, 2013 10:55 am
by caltog
Okey,
Yes holding the last value is fine too.
I've found the following routine 'RowProcGetPreviousValue' but it only works on server job... Is the something identical for parallel jobs?

Regards

Posted: Mon Mar 25, 2013 12:22 pm
by priyadarshikunal
As you know that the stage variables are executed in sequential manner from top to bottom, you can send the current record to one stage variable and then send the value to another stage variable defined above it. So in this was you can hold any value also you can concatenate the columns to hold entire row.

Also if you want to do it for entire set of records ignoring any keys, you might want to run the transformer in sequential mode.