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 6562829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:45:23+00:00 2026-05-25T13:45:23+00:00

I have to entity, A and B (A <<—> B) so an A object

  • 0

I have to entity, A and B (A <<—> B) so an A object can have one B object and a B object can have more than one A object (Correct me if I’m wrong, I’m new to core data relationships).
Now, I want to know how many A objects are in a B object. For example I have a shop (employee <<—> shop) and I want to know how many employee work in that shop.
I’ve create something like this without success:

NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Task" inManagedObjectContext:self.managedObjectContext];
    [request setEntity:entity];

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"project == %@", aProject];
    [request setPredicate:predicate];

    NSError *error = nil;
    NSInteger resultNumber = [self.managedObjectContext countForFetchRequest:request error:&error];
    if (!resultNumber) {
        NSLog(@"Risultati della richiesta nulli!");
        abort();
    }

    NSLog(@"getCountOfProjects called");
    NSLog(@"Results: %@", resultNumber);

    return resultNumber;

Can you help me? Than you so much! 😉

Update
I’ve tried to use this code but it doesn’t work…

-(void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    Project *projects = (Project *)[fetchedResultsController objectAtIndexPath:indexPath];
    cell.textLabel.text = projects.title;
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ entries", [projects.task count]];
}
  • 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-25T13:45:24+00:00Added an answer on May 25, 2026 at 1:45 pm

    Why not just say something like [[myShop employees] count]?

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

Sidebar

Related Questions

I have entity like below, but can't undestand why when i add new record,
I have one entity object (kind) for storing all information from user's advertisement. It
I have an entity that maps to an external oracle table which is one
I have entity framework setup and I have the following relationships setup: AdListing (AdListingID,
I have entity User with one-to-many relationship to UserToUserCategories. When I load user from
I have entity that has a version. It has composite primary key where one
I have Entity Data Model using ADO.NET Entity Data Model (using auto generate from
I'm wondering if using VS.Net 2010, I can have Entity Framework 3.5 code running
I have Entity type class(Serializable, loaded and saved data at runtime) where user specified
If have an entity A with a bidirectional one-or-zero-to-one mapping with entity B. 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.