Could you please help me out on this.
Input -
employee_id, salary
-------------------
10, 1000
20, 2000
30, 3000
40, 5000
1) Create a job to get the next row salary for the current row. If there is no next row for the current row, then the next row salary should be displayed as null.
The output should look like as
employee_id, salary, next_row_salary
------------------------------------
10, 1000, 2000
20, 2000, 3000
30, 3000, 5000
40, 5000, Null
2) Create a job to find the sum of salaries of all employees and this sum should repeat for all the rows.
The output should look like as
employee_id, salary, salary_sum
-------------------------------
10, 1000, 11000
20, 2000, 11000
30, 3000, 11000
40, 5000, 11000
Getting Next row value and cumulative value for all i/p recs
Moderators: chulett, rschirm, roy
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
1) Sort data in reverse order and use stage variables in Transformer stage to "remember" previous row value. If necessary re-sort after Transformer stage.
2) This is a classic 'fork join' design. Use a Copy stage to split your data stream into two. One stream runs through an Aggregator stage to perform the sum. Downstream of that join the two streams together using a dummy constant key generated upstream of the Copy stage (for example using Column Generator stage with a cycle containing one value).
2) This is a classic 'fork join' design. Use a Copy stage to split your data stream into two. One stream runs through an Aggregator stage to perform the sum. Downstream of that join the two streams together using a dummy constant key generated upstream of the Copy stage (for example using Column Generator stage with a cycle containing one value).
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.
Sorry but that's not the way it works around here and if anyone does I'll just delete it.
How about this? Tell us what you've tried so far and what issues you've faced. Failing that, ideas you've had on how to approach this. That rather than simply coming here and pasting in nothing more than the requirements you've been given to develop two jobs.
How about this? Tell us what you've tried so far and what issues you've faced. Failing that, ideas you've had on how to approach this. That rather than simply coming here and pasting in nothing more than the requirements you've been given to develop two jobs.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig - I did try few options which I thought were not best methods / optimal solutions to achieve it. hence, I asked for some suggestions .... Thanks for your feedback ... henceforth, i will post my approaches as well...
I tried another option which worked well. I used 'transformer' looping options to achieve this using "SaveInputRecord() & GetSavedInputRecord()" functions.
It would be great if you could let me know what Ray mentioned in the previous post ... Thanks again!!
I tried another option which worked well. I used 'transformer' looping options to achieve this using "SaveInputRecord() & GetSavedInputRecord()" functions.
It would be great if you could let me know what Ray mentioned in the previous post ... Thanks again!!
