Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4246922
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:02:20+00:00 2026-05-21T04:02:20+00:00

I have a many to many and would like to sort this so that

  • 0

I have a many to many and would like to sort this so that (Event)title is the keyPath listing associated (Person)name below, including duplicates when is the case. something like this.

data model description
Event <<—->> Person, inverse relationships are ‘events’ and ‘people’ each with a single attribute eventTitle and personName.

eventTitle1
personNameA
personNameB
eventTitle2
personNameA
personNameC

I’ve worked with to-one fetchRequests and sorted on keyPath with sortDescriptors. what needs to be done differently for the to many to work this way. Is that enough information? First post, any/ all assistance very appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:02:21+00:00Added an answer on May 21, 2026 at 4:02 am

    I would get the fetch request to get the “Person” entity, and sort by event then person. Sort of like this.

    NSSortDescriptor *eventSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"event.name" 
                                                                         ascending:ascending 
                                                                          selector:@selector(caseInsensitiveCompare:)];
    
    NSSortDescriptor *personSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name"
                                                                        ascending:ascending 
                                                                         selector:@selector(caseInsensitiveCompare:)];
    NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:eventSortDescriptor, personSortDescriptor, nil];
    
    
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Person" 
                                              inManagedObjectContext:self.managedObjectContext];
    [fetchRequest setEntity:entity];
    [fetchRequest setSortDescriptors:sortDescriptors];
    
    NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest 
                                                                                                managedObjectContext:self.managedObjectContext 
                                                                                                  sectionNameKeyPath:@"event.name"
                                                                                                           cacheName:cacheName];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this dilemma many times - and I would like one time and
I would like to mimic the auto-incrementing primary keys feature that many databases have
I have a Tcl/Tk app that generates many forms and would like to be
I have a WCF service with many methods. I would like that after executing
When performing many inserts into a database I would usually have code like this:
I would like to track how many surveys have been done by different departments
I would like to call JavaScript function many time . I have tried like
I have a simple one-to-many relationship. I would like to select rows from the
I have an ActiveX/COM DLL. It contains many methods and properties. I would like
I have strings of this type: text (more text) What I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.