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 == [EMAIL PROTECTED]
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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to