Many-to-many coredata fetch request
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