Hi
I need to know how to get the previously processed records value.
In transformer I have condition ...Current value - Previous value.
Thank You
Regards - c341
Previous Record Values
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can use a pair of stage variables, and rely on the fact that stage variables are processed in the order in which they are defined in their grid.
Techniques have been posted before, search them out. Quick example:
In this example, when stage variable svIsChanged is being evaluated, stage variable svPrevValue still contains the value of InLink.ColName from the previous row.
A more appropriate derivation for svIsChanged isor, more simply
Techniques have been posted before, search them out. Quick example:
Code: Select all
svIsChanged If (InLink.ColName<> svPrevValue) Then 1 Else 0
svPrevValue InLink.ColName
A more appropriate derivation for svIsChanged is
Code: Select all
If (InLink.ColName <> svPrevValue) And (@INROWNUM <> 1) Then 1 Else 0
Code: Select all
InLink.ColName <> svPrevValue And @INROWNUM <> 1
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rigthly said you can use Stage variables to hold prevoius record's value and use it in current record. Stage variable are caluculated in the order they are defined.If you set default value for a stage variable you avoid teh @INROWNUM also
Code: Select all
If (InLink.ColName <> svPrevValue) Then 1 Else 0
Happy DataStaging
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You need to be totally sure that any initial value that you assign to a stage variable will never, ever appear in data. Including @INROWNUM <> 1 is a mechanism that I call "idiot proofing".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.