Is it possible to sort results from Core Data based on the entity type, but:
entityType
, and-(NSString*)typeOfEntity
or similar?I currently have:
TradeDocument
as an abstract entity, with QuoteTradeDocument
and InvoiceTradeDocument
as entities based on it. I want to display entity type and/or allow NSTableView
to be sorted based on this.
I use Cocoa Bindings on OS X.
Note: I am explicitly trying to avoid faulting each object.
Ivan,
The only limit with an abstract entity is that you can't instantiate one. You can still fetch them. Then it is a rather simple matter of testing against which subclass each managed object is.
Sorting on type is not something a sort descriptor can do but a function can, as with -sortUsingFunction:context:
.
Andrew