• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Many-to-many coredata fetch request
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Many-to-many coredata fetch request


  • Subject: Many-to-many coredata fetch request
  • From: email@hidden
  • Date: Wed, 31 May 2006 00:14:10 -0700

Hi all,

I'm having a bit of a trouble getting fetch to execute right.
I have an entity that contains a to-many relation. In the objects of that relation are string values I want to search for.


So its like this:

Entity A ->> EntityWithStrings (e.g names)

So I want to do a search that takes an array of names (multiple selection) and search for objects that contain any of those names.

Someting like "ANY object.tomany.name IN myArrayOfNames"



Here is how I'm constructing my predicate:

NSArray *allNames = [[self selectedObjects] valueForKey:@"name"];

NSExpression *targetKeyPath = [NSExpression expressionForKeyPath:@"people.name"];
NSExpression *targetNames = [NSExpression expressionForConstantValue: allNames];

NSPredicate *weakPredicate = [NSComparisonPredicate predicateWithLeftExpression: targetNames
rightExpression: targetKeyPath
modifier: NSAnyPredicateModifier
type: NSInPredicateOperatorType
options:0];




Andre
email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Many-to-many coredata fetch request
      • From: Andrew Cooper <email@hidden>
  • Prev by Date: Re: Simple Graphs
  • Next by Date: Re: NSPersistentStoreCoordinator not supported in 10.3.9?
  • Previous by thread: ANN: StepTalk 0.12
  • Next by thread: Re: Many-to-many coredata fetch request
  • Index(es):
    • Date
    • Thread