views:

138

answers:

3

Hey there,

I'm new at using CoreData and I'm trying to understand how to perform a query on a table. I can use a fetch request to pull all of the records from a table, but I'm looking for a subset. Is there an easy way to do this?

Thanks, Howie

+4  A: 

Have you looked into Predicates?

Also, buy Marcus Zarra's book on Core Data.

Matt Long
Just to add, for the questioner's understanding: Core Data is an object store, not a relational database. You can have SQLite on the back end, but it's exclusively on the back end—you don't ever work with the database directly.
Peter Hosey
+3  A: 

You can add a NSPredicate to the NSFetchRequest to filter the records that are returned. You can also control what is populated in the returned objects (only populate properties, include relationships, populate nothing, just return a count, etc.) but as Peter pointed out, Core Data is an object hierarchy and model API that just happens to store to a database. It is far easier to work with when you look at it from that POV.

Marcus S. Zarra
A: 
vfn
thanks for all the help
Ward