NSSearchField and Core Data Problem

  • Dear All

    I've been having a few nights in with a bit of Core Data.


    I have an entity called Test. It has two attributes - 'thing' which
    is a string and 'theDate' which surprisingly enough is a date.
    I have bound a two column table to the keyValues and dropped a mm/yy
    type of formatter onto the 'theDate' column (as
    I gather those little cell datepicker widgets don't work properly yet).

    Next I added an NSSearchField thingy to the document.
    Then populated a couple of search predicates - one for 'thing
    beginswith[c] $value', and another for 'theDate > $value'

    The problem I have is how to ensure that I send the correct $value
    object type to the predicate for appropriate search matching.

    I tried dropping a date formatter on the NSSearchField box, which it
    accepted, and this allows me to perform date based searches ok.
    Unfortunately it also tries to send an NSDate when using the 'thing
    beginswith[c] $value'  predicate, which is just plain wrong. I want
    to send
    a string to that one.

    I have tried all sorts of click combinations with the NSSearchField
    in Interface Builder to see if I can just drop a formatter onto a
    drop down
    for the date search, and avoid dropping it on the other. No joy.

    So, I'm assuming that I must have to play around in code with a
    subclass of NSSearchField so that the first search predicate gets
    sent a string (looks like the default)
    and the other one gets sent a date.

    I would be delighted if there were some way to do this in Interface
    builder, but I can't seem to find it.

    Alternatively can the $value be sent as a particular object type by
    modifiying the predicate somehow?

    Helpful suggestions?

    Many thanks

    Matt Brook
previous month october 2006 next month
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today