Link to home
Start Free TrialLog in
Avatar of philsivyer
philsivyer

asked on

extending out dates

Hello

I have a csv file where some of the data needs extending based on what is in current file.
Sample data as follows.........

Cpy                         Period         Repeats       Date                    Value
A001-20110130       Monthly          3              01/02/2011         100
A001-20110330       Null                0              01/04/2010           45
A004-20110130       Quarterley      2              10/02/2011         234
A005-20110130       Null                0              01/06/2011         100
etc
so, based on above data I need to add rows based on "Period & Repeats" columns having values.
Row1 will now have 3 more rows added and the only thing that will change is the date column.
Row 3 will have 2 more rows added and again only the date value will change. The idea is to extend out the dates based on columns "Period & Repeats." Now, my new data set based on the above rules should read as follows....

Cpy                         Period         Repeats       Date                    Value
A001-20110130       Monthly          3              01/02/2011         100
A001-20110130       Monthly                          01/03/2011         100
A001-20110130       Monthly                          01/04/2011         100
A001-20110130       Monthly                          01/05/2011         100
A001-20110330       Null                0              01/04/2010           45
A004-20110130       Quarterley      2              10/02/2011         234
A004-20110130       Quarterley                      10/05/2011         234
A004-20110130       Quarterley                      10/08/2011         234
A005-20110130       Null                0              01/06/2011         100

Hope this makes sense.

Regards

ASKER CERTIFIED SOLUTION
Avatar of billfusion
billfusion

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of philsivyer
philsivyer

ASKER

Thanks - but, any rubyists out there?
Avatar of F. Dominicus
Now where's your try?
OK

I now have a solution