• 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: setNumberOfObjects in an NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setNumberOfObjects in an NSArray


  • Subject: Re: setNumberOfObjects in an NSArray
  • From: David LeBer <email@hidden>
  • Date: Tue, 2 Aug 2005 14:30:11 -0400

On 2-Aug-05, at 2:10 PM, Dev WO wrote:


Hi list,
this might be something trivial, but I'm searching for it for a couple days now, and can't really find the answer...
Actually I'm using a NSArray and not a WODisplayGroup. I'm not very familiar with WODisplayGroup and will learn more about it, but I'd like to know how to do it using an NSArray.
Here's the context:
I've got a list of news, they've got datePosted and dateLastUpdated attributes.
I've created another attribute in the News.java files which is globalDate. The globalDate is equal to the datePosted if dateLastUpdated is null and dateLastUpdated is there's one.
The reason I've created this attribute is because I wanted the news to be sorted using the globalDate and not the datePosted.


But because of globalDate, I cannot use:
setFetchLimit() because it would limit the number of rows before the sorting.
so I'm ok to sort all the news and then only display the first X.


Does anyone know how to do something like setNumberOfObjects on an NSArray?
Or maybe I missed something a lot before, for example if I was able to request a fetch already sorted like the globalDate does it?
That would solved all my problems and allow for using the setFetchLimit (and most probably prevent me from having database slowdown when many news are fetched).




I don't believe you can qualify (or sort) a fetch based on a derived attribute in your .java. Setting a maximum count on your NSArray would not really solve your problem (kind of like closing the stable door after the horses have bolted) you need to do your limiting in your fetch. Is there a problem with setting the dateLastUpdated to 'now' when the News object is created?

Then you could just sort in your fetch on dateLastUpdated.

--
;david

--
David LeBer
Codebase Software Systems
site:   http://www.codebase.ca
blog: http://david.codebase.ca



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: setNumberOfObjects in an NSArray
      • From: Dev WO <email@hidden>
References: 
 >setNumberOfObjects in an NSArray (From: Dev WO <email@hidden>)

  • Prev by Date: setNumberOfObjects in an NSArray
  • Next by Date: Re: Setting Default Values EOModeler
  • Previous by thread: setNumberOfObjects in an NSArray
  • Next by thread: Re: setNumberOfObjects in an NSArray
  • Index(es):
    • Date
    • Thread