• 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
Core Data and auto increment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data and auto increment


  • Subject: Core Data and auto increment
  • From: Eric Morand <email@hidden>
  • Date: Sat, 29 Jul 2006 15:38:20 +0200

Hi list !


I have a customer entity that contains a "customer number" attribute. I want this attribute to be automatically generated when a customer is inserted into the database (SQLite). In other words, I want the customer number attribute to auto-increment.


What's the best way to deal with this ? I'm currently fetching every customers of the database sorted by descending "customer number" and then I use the first customer of the array to compute the new customer number. But I'm wondering if there is not a best solution.

I've tried to use "customerNumber = max(customberNumber)" to retrieve the customer with the greatest customer number, but it doesn't work.

Any advice ?


Thanks,

Eric.
_______________________________________________
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


  • Follow-Ups:
    • Re: Core Data and auto increment
      • From: David Emme <email@hidden>
  • Prev by Date: Re: Re: Sorting NSTableView
  • Next by Date: NSTabViewItem objects not responding appropriately to mouse clicks in custom NSTabView
  • Previous by thread: Binding NSArrayController to 2 NSArrayCOntroller selection
  • Next by thread: Re: Core Data and auto increment
  • Index(es):
    • Date
    • Thread