Fetching entities where the relations are known
Fetching entities where the relations are known
- Subject: Fetching entities where the relations are known
- From: rakel <email@hidden>
- Date: Tue, 10 Oct 2006 23:13:06 +0200
I have a Core Data model, which looks something like [Person] ----*
[Value] *---- [Variable] I.e. the Person entity has a to-many
relation to the Value entity, and the Variable entity also has a to-
many relation to Value. Value in turn has a to-one relation with both
Person and Variable (and before anyone asks, no, this is not a "many
to many"-relational table as seen in ordinary relational databases).
Also, the Value entity has a date attribute, called assessmentDate.
Now, in my application I have a Person instance and a Variable
instance. How do I get all the corresponding Value instances, sorted
on assessmentDate?
I have been trying around with fetch predicates, with no success
( [NSPredicate predicateWithFormat:@"personr == %@", currentPerson ]
does not do the trick). Another idea could be to ask the Person for
the set of all its Values and then the Variable for the set of all
its Values, and then to take the union of those two sets -- but this
won't sort the Values.
Regards /Dan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden