title: Creating sections with NSFetchedResultsController, on the fly
body: <p>I'm using <code>NSFetchedResultsController</code> (NSFRC) to display information in a <code>UITableView</code>. I'm trying to create the option for the user to sort the cells in sections as opposed to alphabetically. The problem is, the sections would then be determined using downloaded information. On top of this the section for each item will be changing relatively often so I don't want to save the section. I have noticed the mention of transient attributes, in my research of similar problems, but i've never used these before I'm not sure if I can use them baring in mind that all the calculations are done once the data has already been loaded, and I also want this solution to be compatible with my previous <code>Core Data database</code>. Also I'm not particularly great at <code>Core Data</code>, (nor <code>Objective-C</code> at that!) so I'm not entirely sure how I'd go about doing this.</p>
  
  <p>So here's what I want to go for if we're using transient attributes (this next bit is theoretical as I don't know if transient attributes are the correct way forward). I would like 4 possible sections, 0-3 (I'll rename them using the <code>TableView delegate</code> to get around sorting problems). When the calculations are done, each cell will be assigned the transient attribute (if needed, the default section would be 2). I hope this all makes sense.</p>
  
  <p>Right, now for some theoretical code. First I create the transient property in the Data Model screen-thing, and make it transient by checking the transient check box... Sounds simple enough. </p>
  
  <p>In the code for the calculations in <code>willDisplayCell</code> (needs to be done in wDC for a couple of reasons), the entity could be saved like this:</p>
  
  <pre><code>MyEntity *myEntity = [self.fetchedResultsController objectAtIndexPath:indexPath];
  
  myEntity.sectionTransientProperty = 2;
  
  if (![self.managedObjectContext save:&amp;error]) {
      NSLog(@"Error: %@", error);
      FATAL_CORE_DATA_ERROR(error);
      return;
  }  
  </code></pre>
  
  <p>Done, right? Is that how we assign a value to a transient property?</p>
  
  <p>Then I change the sorting option in NSFRC when I alloc it:</p>
  
  <pre><code>fetchedResultsController = [[NSFetchedResultsController alloc]
                                  initWithFetchRequest:fetchRequest
                                  managedObjectContext:self.managedObjectContext
                                  sectionNameKeyPath:@"sectionTransientProperty"
                                  cacheName:@"MyEntity"];
  </code></pre>
  
  <p>How are we doing, what else do I need to do? Or have I got this so horribly wrong I should just give up on <code>Core Data and NSFRC?</code> If you guys could help guide me through this I'd really appreciate it. If you need me to post any more code I would be happy to.</p>
  
  <p>Regards,<br/>
  Mike</p>