• 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
Core Data request predicates and to-many relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data request predicates and to-many relationships


  • Subject: Core Data request predicates and to-many relationships
  • From: Luke Evans <email@hidden>
  • Date: Sat, 6 Dec 2008 01:45:55 -0800

If there are any NSPredicate gurus out there, I'm scratching my head on this one:

I have an entity that can optionally have a set of attributes (name- value pairs). This is set up in the model as a optional to-many relationship to an attribute entity.
Now, I want to fetch the list of managed objects of this entity whose attributes exactly match a dictionary that is passed. The predicate for this needs to filter the objects that have all the required attributes; matching both the name, and value for each attribute.


At this point I'm not seeing how you can code this in a predicate. If I AND some clauses like:
...ANY attr.name == %@ AND ANY attr.value == %@...
for each attribute I'm testing for, then AFAICS I'm not testing that the _same_ attr has the name and value.


I wondered about:
...ANY (attr.name == %@ AND attr.value == %@)...
but this doesn't appear to be legal syntax.

I'm still experimenting, but if anyone knows how to express a query that allows multiple clauses on the _same_ entity across a to-many relationship I'd appreciate a clue!

Cheers

Luke



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data request predicates and to-many relationships
      • From: "Melissa J. Turner" <email@hidden>
  • Prev by Date: Re: Asynchronous timers (without a run loop)
  • Next by Date: Reading in XML with iso-8859-1 encoding?
  • Previous by thread: Re: D.O. [NSPortCoder sendBeforeTime:sendReplyPort:] timed out
  • Next by thread: Re: Core Data request predicates and to-many relationships
  • Index(es):
    • Date
    • Thread