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

2010-04-03 Thread Ben Trumbull
They are noted in the NSExpression.h header with API to create them and a comment to their functionality. - Ben Is the use of SUBQUERY() documented anywhere? The only mention I've seen of it is in the reserved keywords section of the Predicate Format String Syntax guide. Dave On Apr

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

2010-04-02 Thread David Hoerl
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,

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

2010-04-02 Thread Dave DeLong
I can't think of a way to do this without iterating over the entire array. It *might* be possible using key-value coding and fancy keypaths and whatnot, but iteration is going to be far simpler to implement and understand. Dave On Apr 2, 2010, at 8:27 AM, David Hoerl wrote: Objects: -

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

2010-04-02 Thread Ben Trumbull
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

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

2010-04-02 Thread David Hoerl
Having the array of attributes unrolled separately is a little odd. Do you mean you have an array of attribute names from, say the entity, and you want to ask a MO for all its non-nil attribute values and get back an array of matching attribute names for those non-nil values? - Ben

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

2010-04-02 Thread Ben Trumbull
On Apr 2, 2010, at 1:30 PM, David Hoerl wrote: Having the array of attributes unrolled separately is a little odd. Do you mean you have an array of attribute names from, say the entity, and you want to ask a MO for all its non-nil attribute values and get back an array of matching

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

2010-04-02 Thread Dave DeLong
Is the use of SUBQUERY() documented anywhere? The only mention I've seen of it is in the reserved keywords section of the Predicate Format String Syntax guide. Dave On Apr 2, 2010, at 3:42 PM, Ben Trumbull wrote: NSComparisonPredicate* exprPred = (NSComparisonPredicate*)[NSPredicate