NSPredicate on sub array items?

  • I have an NSArray managed by an NSArrayController (object class people) with
    each people object containing an NSArray:

    People[0]
    Fistname (String) = John
    Lastname (String) = Smith
    Items (NSArray)
    --Item[0] (String) = Boat
    --Item[1] (String) = Car

    People[1]
    Fistname (String) = Bob
    Lastname (String) = Jones
    Items (NSArray)
    --Item[0] (String) = Truck
    --Item[1] (String) = Trailer
    --Item[2] (String) = Boat

    Is there a way, on the NSArray containing People objects, to create a
    predicate that will find people with an item equal to "boat"

    Or do I need to create a "calculated on the fly" field within people called
    "OwnedItems" that would be built from the array and look like:

    People[0]
    Fistname (String) = "John"
    Lastname (String) = "Smith"
    Items (NSArray)
    --Item[0] (String) = "Boat"
    --Item[1] (String) = "Car"
    OwnedItems (String) = "Boat,Car"

    People[1]
    Fistname (String) = "Bob"
    Lastname (String) = "Jones"
    Items (NSArray)
    --Item[0] (String) = "Truck"
    --Item[1] (String) = "Trailer"
    --Item[2] (String) = "Boat"
    OwnedItems (String) = "Truck,Trailer,Boat"

    So that the predicate is searching at the same "level" as the rest of the
    properties in the object? This method simply concatenates items together one
    one line and inserts them as a separate key within each People object.

    Ultimately, I'd like the "Items" to actually be stored in a common dict so
    it might look like:

    DictKey: 001 id:001 tag:Truck
    DictKey: 002 id:002 tag:Trailer
    DictKey: 003 id:003 tag:Boat
    DictKey: 004 id:004 tag:Car

    This way the Items Arrays would just have numbers (ids) that would refer to
    another array of dicts to ge the actual item name.

    This is to be able to apply "tags" to the People objects from a master list
    of tags/items
previous month may 2013 next month
MTWTFSS
    1 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