• 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: Fetching data into an Array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fetching data into an Array


  • Subject: Re: Fetching data into an Array
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 25 Oct 2007 10:16:18 -0700

I don't think that WORepetition uses iterator() so this should not be the problem.

Chuck

On Oct 24, 2007, at 10:09 PM, Sam Barnum wrote:

There's a bug in NSArray (actually one of the subclasses) where if you call iterator() it doesn't fire the fault. So the iterator is empty. If you use the enumerator or call count() first, it does fire the fault. I'd bet that's what is happening in this case.



--
Sam Barnum
360 Works
http://www.360works.com
415.865.0952



On Oct 24, 2007, at 5:50 PM, Chuck Hill wrote:


On Oct 24, 2007, at 11:58 AM, Calven Eggert wrote:


I was fetching a list of records from a to-many relationship and none of the records were being displayed in my WORepetition. My fetch is a simple valueForKey like so:


NSMutableArray toManyArray = (NSMutableArray) currentRecord.valueForKey("toManyRelationship");

That is not a fetch. That is accessing an to many relationship which may or may not be a array fault or an array of faults.


That should be fine (a little ugly, but I'll assume you have a reason to access it like this). If you are not seeing the records, I will guess that the relationship is still an array fault and the fault is not getting fired. I can't think of why that would be other than violating one of the EOF commandments or messing with the generated EO code so that willRead() does not get called.


Then I tried this for the heck of it:

NSMutableArray tempArray = (NSMutableArray) currentRecord.valueForKey("toManyRelationship");
toManyArray = new NSMutableArray();
toManyArray.addObjectsFromArray(tempArray);


My records were now being displayed.

Can anyone explain to me why this is so?

The second bit of code must be doing something to cause the array fault to be fired. What you are seeing is not normal. I suspect the problem lies in your Java code or possibly in a bad build.


Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






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


This email sent to email@hidden

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


This email sent to email@hidden

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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


References: 
 >Fetching data into an Array (From: Calven Eggert <email@hidden>)
 >Re: Fetching data into an Array (From: Chuck Hill <email@hidden>)
 >Re: Fetching data into an Array (From: Sam Barnum <email@hidden>)

  • Prev by Date: Re: Fetching data into an Array
  • Next by Date: Re: Fetching data into an Array
  • Previous by thread: Re: Fetching data into an Array
  • Next by thread: Many-to-many question ...
  • Index(es):
    • Date
    • Thread