adding sub sequence using stages

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
dsisbank
Premium Member
Premium Member
Posts: 50
Joined: Fri Aug 11, 2006 4:53 am

adding sub sequence using stages

Post by dsisbank »

Hi,
I am junior developer and have problem.I have source data like above.Credit_id is increasing automatically

credit_id proposal_id
1 1
2 1
3 1
4 2
5 2
and i want to put this data to target like this

credit_id proposal_id credit_index
1 1 1
2 1 2
3 1 3
4 2 1
5 2 2

how can i do?
thanks for your helps
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi Welcome aboard!!! :D
You can simply use sort stage and sort based on Proposal_id and include a column to detect the change in Key column option to have the serial number to be generated. Optionally you can use transformer to detect the change in previous row to the current row.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
dsisbank
Premium Member
Premium Member
Posts: 50
Joined: Fri Aug 11, 2006 4:53 am

Post by dsisbank »

thanks for your helping
but how can i detect the change in previous row to the current row in transformer
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The Sort stage can generate two extra columns (key change and cluster key change). You need the first of these. Pass it into your Transformer stage and use it to reset your counter (a stage variable, probably) to 1 when the key value changes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply