NSSearchField NSPredicateFormatBinding and to-many relationships
NSSearchField NSPredicateFormatBinding and to-many relationships
- Subject: NSSearchField NSPredicateFormatBinding and to-many relationships
- From: Ken Victor <email@hidden>
- Date: Wed, 6 Sep 2006 17:42:06 -0700
from the list archives, i've discovered that its possible to set the
filterPredicate of an NSArrayController for a to-many relationship as
follows:
NSPredicate* pred = [NSPredicate predicateWithFormat:
@"any anAttribute.name like[cd] %@", @"*seachString*"];
[arrayController setFilterPredicate: pred];
(where anAttribute.name represents a to-many relationship)
this lets me filter the entities in my table to those entities that
contain one or more of anAttribute whose name contains the string
seachString. (similarly, if i omit the leading or trailing asterisk
in the above, i can perform begins with, ends with, or equals
comparisons.)
my window contains an NSSearchField and i setup the predicate
binding(s) programmatically. is it possible to setup an
NSPredicateFormat binding that is equivalent to the above snippet?
ie, what i would like the format string to be is:
any anAttribute.name like[cd] "*$value*"
but either this isn't possible, or i haven't figured out the proper
way to get the quoting. does anyone know if it is possible or not?
and if it is, could you please indicate the proper format string to
use for the search field predicate format binding?
thanx,
ken
_______________________________________________
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