Predicate Row Template array within array
Predicate Row Template array within array
- Subject: Predicate Row Template array within array
- From: Trygve Inda <email@hidden>
- Date: Sun, 30 Nov 2014 10:05:36 -0800
- Thread-topic: Predicate Row Template array within array
I have an array of objects that looks like:
{
NSString* name;
NSDate* date;
NSArray* words;
}
The words array looks like:
{
NSString* id;
NSString* word;
}
I need to build a Predicate Row template to result in a way to search for
names, dates, and words. The first two are easy using basically:
[NSExpression expressionForKeyPath:@"name"];
template = [[NSPredicateEditorRowTemplate alloc]
initWithLeftExpressions:expressions
rightExpressionAttributeType:NSStringAttributeType
modifier:NSDirectPredicateModifier
operators:operators
options:0];
This gives me a predicate:
name CONTAINS[cd] "Fred"
But how can I build a row template to search for an object whose "words"
array contains a specific "word"?
Just in code it would be:
predicate = [NSPredicate predicateWithFormat:@"%@ IN words", someword];
How can I apply that sort of logic to my row template so that the left
expression would be "words", operators would be:
NSBeginsWithPredicateOperatorType
NSEndsWithPredicateOperatorType
NSContainsPredicateOperatorType
But that would give me:
words CONTAINS[cd] "Fred"
Which is not what I want.
How can I get the effect of the "%@ IN words" in a row template? This will
cause it to search for objects that contain a words array that contains a
specific word.
Thanks,
Trygve
_______________________________________________
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