Re: NSPredicate for a ANY match based on two properties at once
Re: NSPredicate for a ANY match based on two properties at once
- Subject: Re: NSPredicate for a ANY match based on two properties at once
- From: Jesse Grosjean <email@hidden>
- Date: Fri, 20 Jun 2008 15:06:29 -0400
I want to construct searches such as:
- find all entries that have a the tag named "priority" with
the
value "1".
NSPredicate *tagPredicate = [NSPredicate predicateWithFormat:@"ANY
tags.name = %@", tag.name];
NSPredicate *valuePredicate = [NSPredicate predicateWithFormat:@"ANY
tags.value = %@", tag.value];
NSPredicate *combinedPredicate = [NSComparisonPredicate
andPredicateWithSubpredicates:[NSArray arrayWithObjects:tagPredicate,
valuePredicate,nil]];
Thanks, but I don't think this quite works. The problem is that the
two ANY predicates aren't forced to match against the same tag. So if
the potential matching entry has multiple tags this query will match
if any of those tags match the tag name, and if any of the tags values
match the tag name, but there's no constraint that a the same tag
value pair matches both constraints.
Jesse
_______________________________________________
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