• 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 Matches
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicate Matches


  • Subject: Re: NSPredicate Matches
  • From: Keary Suska <email@hidden>
  • Date: Thu, 17 Dec 2009 08:20:28 -0700

On Dec 16, 2009, at 10:18 PM, Gerriet M. Denkmann wrote:

>
> I have a Core Date entity A which has a to-many ralationship called theBs.
> And a Core Date entity B which has a to-many ralationship called theCs.
> And a final Core Date entity C which has an NSString attribute called someString.
>
> I tried to find all A entities which contain "xyz" by using an NSPredicate: "ANY theBs.theCs.someString MATCHES ".*xyz.*" "
>
> But all I got was an error message:
> Can't do regex matching on object [description of an NSSet with all the someStrings connected to the first A entity].
>
> When I change the predicate to: "ANY theBs.theCs.someString CONTAINS  "xyz" " it kind of works, but for xyz = "change the" I get no finds, whereas for xyz = "change the price" the predicate finds one entity (correct), and for xyz = "change the p" it finds nothing again.

I would expect both approaches to fail, but at least I am not surprised that "contains" gives undefined results. The issue is crossing multiple to-many relationships. AFAIK, NSPredicate can't do that. Have you tried using an array operator, such as @unionOfSets? I don't know whether it would work, but there is a theoretical possibility ;-) Otherwise, you will need to use code to get the results you need.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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 Matches
      • From: "Gerriet M. Denkmann" <email@hidden>
References: 
 >NSPredicate Matches (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Drawing into myView
  • Next by Date: narraycontroller sort performance problems
  • Previous by thread: NSPredicate Matches
  • Next by thread: Re: NSPredicate Matches
  • Index(es):
    • Date
    • Thread