NSSortDescriptor for A <-->> B <-->> C relationships

18 views
Skip to first unread message

Decoder

unread,
Jul 12, 2013, 12:40:55 PM7/12/13
to cocoa-...@googlegroups.com
I am trying to initialize a NSFetchedResultsController.

In the data model I have 3 entities related to each other like this:

    A <-->> B <-->> C

(ie. A to B: one to many relationship and B to C: one to many relationship)

Entity 'A' has a property 'name' and entity 'C' has property 'someDate'.

I want to get all managedObjects belonging to entity 'A', sorted in below order, when I fire a fetch request against it:

1. 'someDate' == today's date (AND) ascending order by name

2. ascending order by name

ie. first it should enlist the objects in 'A'  for which 'someDate' in 'C' is today's date, this list should be further sorted by 'name', then it should enlist remaining objects in 'A' (for which 'someDate' != today's date) sorted by 'name'

Please suggest how can I achieve it in a single fetch request.
Reply all
Reply to author
Forward
0 new messages