• 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
NSPredicate/NSExpression - can they solve this Core Data problem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPredicate/NSExpression - can they solve this Core Data problem?


  • Subject: NSPredicate/NSExpression - can they solve this Core Data problem?
  • From: David Hoerl <email@hidden>
  • Date: Fri, 02 Apr 2010 10:27:28 -0400

Objects:
 - NSManagedObject *item - some managaged object
 - NSArray *attributes - an array of the item's attributes

Desired Result:
- a possibly smaller array of attribites where [item valueForKey:<an attribute>] != nil.


In code, I can simply iterate over the keys, perform the valueForKey, and skip nil values. I played around with expressions and predicates to solve this, to no avail.

I completely understand that the code solution is probably the way to go - however, I'd be interested to know if a solution using NSArray's filteredArrayWithPredicate and/or some combination of predicates and expressions could provide the answer - as an academic exercise.

David
_______________________________________________

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/NSExpression - can they solve this Core Data problem?
      • From: Dave DeLong <email@hidden>
  • Prev by Date: Alternative startup for application
  • Next by Date: Re: NSDocument and the dreaded "The location of the document XXX cannot be determined"
  • Previous by thread: Re: Alternative startup for application
  • Next by thread: Re: NSPredicate/NSExpression - can they solve this Core Data problem?
  • Index(es):
    • Date
    • Thread