View Full Version : CSV processing: rearranging 3 master rosters into 12 separate ones

08-31-2011, 01:06 AM
I was asked to do some volunteer coding for a youth sports organization I've participated in.

Basically, there are three rosters in CSV format: a player roster, a "mother" roster, and a "father" roster. Each one has columns for first name, last name, address, various contact information, etc. The player roster includes a column for grade, and the parent rosters include columns for each of their children's names.

I'm supposed to create individual rosters for each grade. The new rosters have a similar, but slightly different and simplified series of columns. Each new roster has to include a row for every player in the grade, plus a row for each student's mother and father.

I'm guessing that the program should probably cycle through every row of the player roster, find the student's first and last name, then go through the parent rosters and find the parents that match the first and last name. It should then identify, aggregate, and rearrange all the information attached to those entries (player, mother, father) into three new rows, and append them to the appropriate new grade roster. Or maybe each grade would be isolated and done separately.

I'm just not sure how to accomplish this. I've done form processing in PHP before, but I don't know how I can use that skill in this context. I'm at a loss and I could really use some advice. Does anyone have any suggestions?

08-31-2011, 01:27 PM
Show us a few lines from each CSV file.

Then, show a few lines of how the final CSV should look for one of the 12 grades.

And finally ...
Are the CSV files coming from an Excel sheet? And if so, why not use Excel?