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

  • Home
  • SEARCH
  • 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 740043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:28:12+00:00 2026-05-14T08:28:12+00:00

OK so I have two entities in my data model (let’s say entityA and

  • 0

OK so I have two entities in my data model (let’s say entityA and entityB), both of these entities have a to-many relationship to each other.

I have setup a NSFetchedResultsController to fetch a bunch of entityA. Now I’m trying to have the section names for the tableview be the title of entityB.

sectionNameKeyPath:@"entityB.title"

Now this causes a problem, where by the section name returned from that relationship appears to be ({title1}) or ({title1,title2…titleN}) obviously depending on how many different entityB’s are involved. This doesn’t look great in a tableview and doesn’t group the objects as I would like.

What I would like is a section per entityB title with entityA appearing under each section, under multiple sections if necessary. I’m at a loss as how I am supposed to achieve this whether I need to update the predicate to get the entity to appear multiple times or whether I need to update the section and header functions to do some processing as the controller loops through the objects.

Any help is appreciated 🙂

Thanks

  • 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-14T08:28:12+00:00Added an answer on May 14, 2026 at 8:28 am

    You will get that because the call @”entityB.title” is going to return an array|set of titles. That is what you are seeing as it is translating into:

    NSSet *titles = [myEntityA valueForKeyPath@"entityB.title"];
    

    To fix this, you need to reverse your NSFetchedResultsController so that you are fetching EntityA objects through EntityB objects. Then your sectionKeyPath (and your primary sort) would be against just @”title”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two entities Foo and Bar with a Many to Many relationship between
I have two entities, Entity1 and Entity2, on a one to many relationship. On
In my Core Data model I have two entities: List and Patient. List has
I have the following core data model with two entities: entity item which holds
I have two entities, each from a different database and therefore different edmx files.
I have two tables Group and Customer and of course two entities Group and
I have a situation where I have two entities that share a primary key
I have two applications written in Java that communicate with each other using XML
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
Let's say you are a GM dba and you have to design around the

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.