title: Best way to maintain column data when importing multiple formats
body: <p>I have an app that imports a .CSV file and turns each line into a Core Data object that is stored in a database.  The CSV files that I am importing have about 40-something columns and each column maps to an attribute of the Core Data object.</p>
  
  <p>When I started the project, there was only one CSV format that I was working with, so I just wrote 40-something lines of un-elegant static code to import the file, such as:</p>
  
  <pre><code>...
  newEntity.yearOfConstruction      = [NSNumber numberWithInt:[[currentRow objectAtIndex:35] integerValue]];
  newEntity.assessedValue           = [NSNumber numberWithInt:[[currentRow objectAtIndex:36] integerValue]];
  newEntity.squareFootageOfProperty = [NSNumber numberWithInt:[[currentRow objectAtIndex:37] integerValue]];
  ...
  </code></pre>
  
  <p>Now the problem that I've run into is that I would like to import other CSV file formats that are ordered differently than those in my original use case.</p>
  
  <p>Rather than write a <code>switch(CSVFormatType)</code> and add additional 40-line sets of code, what is the <em>elegant</em> way to store the CSV column-to-Core Data mapping for an arbitrary number CSV file types and just one set of code to create the Core Data objects?</p>
  
  <p>Thanks!</p>