• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData: Getting the last object of a relation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >CoreData: Getting the last object of a relation (From: email@hidden)
 >Re: CoreData: Getting the last object of a relation (From: George Orthwein <email@hidden>)

  • Prev by Date: Re: Helper Tool on FireWire
  • Next by Date: Re: Bound NSBrowser always shows horizontal scrollbar
  • Previous by thread: Re: CoreData: Getting the last object of a relation
  • Next by thread: Re: CoreData: Getting the last object of a relation
  • Index(es):
    • Date
    • Thread