• 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: can I use fetch spec to filter an array?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can I use fetch spec to filter an array?


  • Subject: Re: can I use fetch spec to filter an array?
  • From: Denis Stanton <email@hidden>
  • Date: Thu, 1 Jan 2004 15:03:10 +1300

On Thursday, January 1, 2004, at 02:05 PM, Chuck Hill wrote:

Does this mean that I could fix the slow response time on the first
execution by simply reading all bookings (within date range) into an
array before beginning the other processing, even if that array is not
otherwise used in my program?

Yes, that should help provided this is in the same EC as your reporting
data. However, if you are interating over the bookings() array on Agent it
will also pause to fetch all the other bookings to determine if it needs them.

Excellent point. My test below read in all bookings for date range, but my iterator would have checked all bookings in each agent.bookings() relationship, requiring the load of all those booking rows that were not actually required and therefore not covered by the pre-fetch


While I'm on the topic, there is no need for this:
NSArray bookings = new
NSArray(editingContext.objectsWithFetchSpecification(fetchSpec));
Just use
NSArray bookings = editingContext.objectsWithFetchSpecification(fetchSpec);

I noticed that variation in my own code a few days ago, and wondered whether it was necessary. It's the way I have always done it so whatever my original reasoning it has just become habit.


This seems like a very bad thing.  I click the submit button in a
little query form at the top of the page and WO has to re-expand the
whole rest of the page before it can figure out that the submit button
was clicked?

No, just until it finds what was clicked. This is why it is a bad idea to
return null from action methods: WO keeps looking for the component
responsible for the action. With the query form at the top it should stop
fairly quickly. If you put the form inside a table or at the bottom of the
page it can be a different story.

That's odd. The submit button is in a form at the top of the page. After that there is a repetition that works through the agent list, but there are no further active elements. Repeated (and pointless) calls to setAgent are made before it finds and executes the action method bound to the submit button


This page has no links from inside the repetition.  There
seems to be no reason to re-expand the page.

It is just doing a tree traversal until it finds the correct action. If
your action method has
return null;
that is the cause. Do this instead:
return context().page();

OK, that worked. Why is return null the standard (default) response? I never understood how returning null created the page. It now seems to me that returning null amounts to "keep looking for something to do, and if you don't find it just repeat this page"


Denis Stanton
email@hidden
Home:  +64 9 533 0391
mobile: +64 21 1433622
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: can I use fetch spec to filter an array? (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Advice on dynamic graphics with WO
  • Next by Date: Re: Advice on dynamic graphics with WO
  • Previous by thread: Re: can I use fetch spec to filter an array?
  • Index(es):
    • Date
    • Thread