Skip navigation.
 
mlNeed some help with fetch requests
FROM : Carter R. Harrison
DATE : Fri Feb 01 21:03:32 2008

Hi All,

Today I'm working with NSFetchRequests for the first time and I need 
some help learning how to filter down the initial set of managed 
objects that I want to search against.  My application is a sort of 
message viewer/editor.  A user can open up multiple files, each 
containing some number of messages.  Messages themselves are broken 
down into any number of fields.  So my managed object model follows 
that same type of hierarchy..

Entity: File
Relationship: Messages

Entity: Message
Relationship: Fields

Entity: Field
Property: Value (string)

When a user performs a search, the search will be performed on the 
"Field" entity's "Value" property.  I can make this work great with an 
NSFetchRequest.  My issue is that the search is searching all Field 
objects, even if they are owned by a different file.  I want to be 
able to search just the fields in the currently selected file, rather 
than all files that are currently open in the application.  Hope that 
makes sense.  My initial thought was to add more criteria to my 
predicate to help narrow down the search base, but I'm not sure how 
the predicate's criteria could traverse relationships.  Thanks in 
advance for the assistance.

Regards,
Carter

Related mailsAuthorDate
mlNeed some help with fetch requests Carter R. Harrison Feb 1, 21:03
mlRe: Need some help with fetch requests Chris Hanson Feb 1, 21:36
mlRe: Need some help with fetch requests Carter R. Harrison Feb 1, 21:41