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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:09:07+00:00 2026-05-26T07:09:07+00:00

This is driving me crazy and most likely I am doing this wrong. So

  • 0

This is driving me crazy and most likely I am doing this wrong.

So I have two entities: Criteria and Option that has a many to many relationship.

The attributes for each are

Option:
optionName

Criteria:
criteriaName
criteriaRank

In my app, I create all my options and set its name.

Then I insert a criteria and add that to each option :

Criteria *aCriteria = [NSEntityDescription insertNewObjectForEntityForName:@"Criteria" inManagedObjectContext:[decision managedObjectContext]];

    aCriteria.criteriaRank = [NSNumber numberWithInt:1];

// Add the new criteria to the criteria array and to the table view.    
[criteriasArray addObject:aCriteria];


NSEnumerator *enumerator = [fetchedOptions objectEnumerator];
Option *anOption;
while(anOption = [enumerator nextObject])
{
    [anOption addCriteriasObject:aCriteria];
}

What I want is that for each option, I can rank each criteria but when I load the criteria list for each option and set its rank via a slider and save, all the other options display the same value i just updated.

I am fetching the criteria in the following manner:

//fetch all criterias
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"criteriaName" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
    NSMutableArray *sortedCriterias = [[NSMutableArray alloc] initWithArray:[option.criterias allObjects]];
[sortedCriterias sortUsingDescriptors:sortDescriptors];
self.criteriasRankingArray = sortedCriterias;

I want to be able to add a criteria and then under each option, rank each criteria.
Am I approaching this the wrong way? Help!!

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-26T07:09:08+00:00Added an answer on May 26, 2026 at 7:09 am

    If you are adding the same Criteria objects to different Options, then you will see this behavior. You’ll have to create brand new Criteria objects for each of your Option objects. It looks like you are reusing your Criteria objects across multiple Options, which does not sound like what you want. You seem to want unique Criteria for each Option object.

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

Sidebar

Related Questions

Ok, this is driving me crazy. I have a CA that needs to know
This is driving me crazy. I have this one php file on a test
This is driving me crazy and has resulted in lost work (not much, at
This is driving me crazy. I have a very simple user control: public int?
This has been driving me crazy for a few days. Why doesn't the following
This has been really driving me crazy. Web links work fine, but a phone
This is driving me crazy! I have read at least 5 questions on here
This is driving me crazy: I have function void gst_init(int *argc, char **argv[]); in
This is driving me crazy. I have the following string in a ASP.NET 2.0
This is driving me crazy. I have a library I source from multiple scripts,

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.