Hi All,
I have file which has values in a column like below.
col
100
250
300
500
I need to compare if row 1(100)> row 2(250) and row 2(250)> row 3(300)and row 3(300) > row 4 (500),,
Basically I am trying to find if the next row value in a column is greater than the current row value of the same column... If they are increasing from first to last value in the column then send it to a file.
Datastage
Moderators: chulett, rschirm, roy
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard.
This is not really an ETL task, but you can readily use stage variables in a Transformer stage to keep track of the previous row's value(s) in order to effect your comparison(s).
Another stage variable can be used to monitor your "first to last" (begin true, set to false on any exception) and this could form the constraint on the output link to the file.
This is not really an ETL task, but you can readily use stage variables in a Transformer stage to keep track of the previous row's value(s) in order to effect your comparison(s).
Another stage variable can be used to monitor your "first to last" (begin true, set to false on any exception) and this could form the constraint on the output link to the file.
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.
Hi
we can do this is server job with stage variable as below.
stagevar1=RowProcGetPreviousValue(input.column)
stagevar2=input.column
if(stagevar2<stagevar1) then "yes increasing" else "no"
I tried in parallel job using stage variable but not successful.
Please share your thoughts.
Thanks in advance..
we can do this is server job with stage variable as below.
stagevar1=RowProcGetPreviousValue(input.column)
stagevar2=input.column
if(stagevar2<stagevar1) then "yes increasing" else "no"
I tried in parallel job using stage variable but not successful.
Please share your thoughts.
Thanks in advance..
Hi Craig
I tried with two stage variables.
PreviousValue = CurrentValue
CurrentValue = input.column
if (CurrentValue < PreviousValue) then ""
Here initially currentvalue does not hold any values then the column values are assigned to previousval stage variable to perform comparision.
I tried with 2 node configuration.
I tried with two stage variables.
PreviousValue = CurrentValue
CurrentValue = input.column
if (CurrentValue < PreviousValue) then ""
Here initially currentvalue does not hold any values then the column values are assigned to previousval stage variable to perform comparision.
I tried with 2 node configuration.
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You must perform the comparison before the "remembering" stage variable is executed.
(You don't actually need svCurrentValue.)
Use the value of svIsIncreasing in your constraint logic.
Code: Select all
svCurrentValue <--- input column
svIsIncreasing <--- (svCurrentValue > svPreviousValue)
svPreviousValue <--- input columnUse the value of svIsIncreasing in your constraint logic.
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.
