How to populate previous row using transformer

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

How to populate previous row using transformer

Post by times29 »

Hi,
Source date look like

Code: Select all

doc_num , doc_num_reject ,cost_sk ,order_sk ,doc_last_num
123          123               -1       -1             null

123                            -1       202            123
how can i compare two rows and populate doc_num_reject( -->123) for second row.

Code: Select all

doc_num , doc_num_reject, cost_sk ,order_sk ,doc_last_num
123          123               -1       -1         null

123       -->123               -1      202       123
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So not actually populating the previous row but the current row with data from the previous row. That's just stage variables in a transformer. Since stage variables are evaluated top to bottom, you've always been able to hold on to any previous value from a row and leverage it in future rows.
-craig

"You can never have too many knives" -- Logan Nine Fingers
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

Post by times29 »

Can you please remove premium content from post as my membership has expired and i have not renewed it yet
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not sure there's a need for that. How familiar are you with stage variables? This is pretty basic 'group change detection' logic you would need to leverage. There are a number of examples that you could adapt for this, here is one.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply