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 (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to