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 protected])

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

This email sent to [email protected]

Reply via email to