• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSPredicate for a ANY match based on two properties at once
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSPredicate for a ANY match based on two properties at once
      • From: "Jim Turner" <email@hidden>
References: 
 >NSPredicate for a ANY match based on two properties at once (From: Jesse Grosjean <email@hidden>)
 >Re: NSPredicate for a ANY match based on two properties at once (From: "Jim Turner" <email@hidden>)

  • Prev by Date: Re: SSCrypto Framework
  • Next by Date: [Moderator] Re: OT: Announcing Pi, the Phoenix iPhone Developer Group
  • Previous by thread: Re: NSPredicate for a ANY match based on two properties at once
  • Next by thread: Re: NSPredicate for a ANY match based on two properties at once
  • Index(es):
    • Date
    • Thread