How to create duplicate rows from input dataset with respect to a condition
Hi All,
I have a Order start date (ORDER_ST_DT DATE) and an order completion date (ORDER_END_DT DATE). If the difference between start and completion date is greater than 5 then that record has to be duplicated that much times.
For eg, if the difference is 10 the same row has to be duplicated 10 times! Do we have any method in DataStage Parallel jobs to implement the same?
Thanks in Advance
Ajith
Creating duplicate rows from input dataset
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
I am not sure if any stage can work like this.
But this can be done using a BuildOp.
As it is dynamic i.e. the total number of rows to be created, I think you might have to built a BuildOp in which you can create a loop and output rows as per this value of the diff between two cols.
Create a column which will store the diff between two dates. Pass this to Build op. In the BuildOp add a loop upto this diff col and output row in the loop.
But this can be done using a BuildOp.
As it is dynamic i.e. the total number of rows to be created, I think you might have to built a BuildOp in which you can create a loop and output rows as per this value of the diff between two cols.
Create a column which will store the diff between two dates. Pass this to Build op. In the BuildOp add a loop upto this diff col and output row in the loop.
Regards,
S. Kirtikumar.
S. Kirtikumar.
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You might most easily be able to accomplish this in a shell script invoked from an External Filter stage. There does not have to be a one-to-one mapping between input and output row counts from this stage type.
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.