Hope that helps.
- Andrew Cooper -
On May 31, 2006, at 2:14 AM, email@hidden wrote:
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:
40gmail.com
This email sent to 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