Re: CoreData: Getting the last object of a relation
Re: CoreData: Getting the last object of a relation
- Subject: Re: CoreData: Getting the last object of a relation
- From: email@hidden
- Date: Sun, 25 Jun 2006 11:02:25 +0200
Thanks for your help! I did it as you proposed with an id and the use of @max.
Just like with a normal database.
Best regards
Gian Marc
1. [self valueForKeyPath:@"transactions.@lastObject"] -> doesn't
work, because
CoreData doesn't know "@lastObject".
Does anything know "@lastObject"? ;)
@ denotes a collection operator, so it would have to be listed on this page:
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueCoding/Concepts/ArrayOperators.html
I think you'll probably need to add an additional attribute in the
model. Either a lastInserted that you can set for the last inserted
(and clear the previous) or you could number the inserts with an ID
and you'll know the last inserted by the highest ID.
Also, if this can (or should) be moved to the controller layer then
there are probably other options....
Hope that helps,
George
_______________________________________________
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