• 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: DistinctRows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DistinctRows


  • Subject: Re: DistinctRows
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 03 Mar 2003 16:04:50 -0800
  • Organization: Global Village Consulting, Inc.

Ah, that is a good point! I did not look closely enough at the code. I always normalize and never duplicate things so it did not occur to me.

Jonathan, you *could* use a NSSet like this:

NSArray pageNameList = EOUtilities.objectsForEntityNamed(ec,
"TbNavPage");
NSSet uniquePageNameList = new NSSet(pageNameList.valueForKey("name"));
NSMutableArray sortedNavPageNameList = new
NSMutableArray(uniquePageNameList.allObjects());

(changing "name" to whichever attribute you want). But that will give you a list of strings, not EOs. Thus, you will need to change your searching logic a fair bit. Though, as with Art, I'm not really sure where we are going.


Chuck


Art Isbell wrote:

On Monday, March 3, 2003, at 01:16  PM, Chuck Hill wrote:

There are several ways to accomplish this, including raw SQL and fetch specs set to fetch distinct rows.


It's not clear to me that the rows fetched aren't already distinct. No fetch spec is being used to fetch the objects, so unless duplicate rows are in the DB, only the attribute value being displayed in the popup button is not distinct.

NSArray pageNameList = EOUtilities.objectsForEntityNamed(ec, "TbNavPage");
NSSet uniquePageNameList = new NSSet(pageNameList);
NSMutableArray sortedNavPageNameList = new NSMutableArray(uniquePageNameList.allObjects());


I initially thought about using NSSet, but this won't work unless the objects in the set are truly duplicates. I suspect only the attribute bound to the popup button's displayString key is not distinct. But if that's the case, you wouldn't normally want to eliminate some of the objects from the popup button list. Something's missing from this picture. Jonathan?

Art
http://homepage.mac.com/aisbell/
_______________________________________________
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.


--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net
_______________________________________________
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: DistinctRows (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: Help: unreported exception java.io.IOException; must be caught or declared to be thrown
  • Next by Date: Re: DistinctRows
  • Previous by thread: Re: DistinctRows
  • Next by thread: Re: DistinctRows
  • Index(es):
    • Date
    • Thread