Skip navigation.
 
mlBinding filterPredicate -- not working yet
FROM : Jeremy Faller
DATE : Thu Jul 20 00:46:43 2006

All:

  I am having a problem using an NSArrayController 'filterPredicate' 
bound in IB.  Here's what's happening:

  - My NSArray and NSPredicate live in the document.  They are 
accessed through the 'File's Owner'.
  - For simplicity, the objects in the array contain 3 fields, let's 
call them "firstName" "lastName" and "type".
  - If I just display the first and last names in a tableview, 
everything is fine, when I add the filterPredicate that is returned 
from my document class, I get no objects populating in my table.
  - My predicate looks like:

       [self setValue:[NSPredicate predicateWithFormat:@"type < 3"] 
forKey:@"fooPredicate"];

  - I bind the "filterPredicate" to "fooPredicate" and nothing gets 
displayed in my table view.

Two other notes, the 'type' is stored as an integer in the object I 
am trying to display NOT an NSNumber.  I'm not sure if this is a 
problem.  (Maybe I will investigate this while awaiting an 
answer...)  Additionally, I am not changing the filter predicate at 
runtime.  (I am comfortable with 2 NSArray controllers splitting my 
data into two sets unless there is cleaner mechanism.)

Does anyone know if I am I doing wrong?  Is there a simpler way I 
could do this?  Are there any examples out there doing what I am 
trying to do?  Most examples I have found bind filterPredicate to a 
search field.

Thanks in advance everyone.

Best Regards,
Jeremy R. Faller

Related mailsAuthorDate
mlBinding filterPredicate -- not working yet Jeremy Faller Jul 20, 00:46
mlRe: Binding filterPredicate -- not working yet Matt Neuburg Jul 20, 05:19