Hi all.
Maybe there is a simple solution to this, but I'm getting headache of this, I'm fairly new with all this Core Data stuff:
I have a BankAccount class/entity with an "index" attribute, used for sorting, and a "transactions" to-many relationship to the Transaction class/entity. This Transaction entity has a "date" attribute, that I want to use for sorting too.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[NSEntityDescription entityForName:@"BankAccount" inManagedObjectContext:self.managedObjectContext]];
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"index" ascending:YES];
[fetchRequest setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];
This works well and delivers me the BankAccount objects nicely sorted by "index". But, each BankAccount object contains a NSSet "transactions" that is, ofcourse, not sorted at all. How can I get these transactions sorted by the "date" attribute, and is this possible within the same fetch request?
Many thanks in advance.