Re: DistinctRows
Re: DistinctRows
- Subject: Re: DistinctRows
- From: "Jonathan Fleming" <email@hidden>
- Date: Wed, 05 Mar 2003 17:59:19 +0000
Hi Chuck,
I went with your second option and normalized the data.
For something that seemed so simple normalizing became an involved task.
I must say I'm glad I learned of this mistake now rather than later, from
the two links you pointed me to I saw that I was on a rocky road to
problemville, so many thanks to you sir.
And anyone else who's not clued up about database design /modeling take heed
and have a look at those links below, it'll straighten out some rough edges
now so you don't end up trying to iron out monster jaggies later on.
Cheers Chuck
From: Chuck Hill <email@hidden>
To: "Jonathan Fleming" <email@hidden>,
email@hidden
Subject: Re: DistinctRows
Date: Mon, 03 Mar 2003 22:03:46 -0800
Jonathan,
You seem to have two choices. Which you choose depends on what your
requirements are and how much effort you are willing to go to achieve them.
Is the NavPage name just an attribute that the user can type in, providing
anything they feel like? If so, the easiest way to get what you want is to
use the NSSet code I posted earlier after sending an valueForKey("name")
message to the array of fetched NavPages. This will result in the popup
getting populated with the name Strings. You you will need to search on
selection rather than selection.name While not very efficient this will be
OK for small datasets.
Is the NavPage name more like a type, of which there is a finite set? If
so, what you want to do is to normalize your data. Here is some light
reading from a quick Google search:
http://www.devshed.com/Server_Side/MySQL/Normal
http://www.cctc.demon.co.uk/normalise.htm
To do this, create a new EO called NavPageName or NavPageType. This will
contain just a primary key and a name. Each possible name/type will become
an object of NavPageType. The name attribute of NavPage will be replaced
with a to-one relationship to NavPageType. Then you fill the popup with
NavPageName instead of NavPage. Again, you you will need to search on
selection rather than selection.name
Chuck
At 03:17 AM 04/03/2003 +0000, Jonathan Fleming wrote:
>
>
>>From: Chuck Hill <email@hidden>
>>To: "Jonathan Fleming" <email@hidden>, email@hidden,
>>email@hidden, email@hidden
>>Subject: Re: DistinctRows
>>Date: Mon, 03 Mar 2003 19:04:39 -0800
>>
>>Well, if there are three TbNavPage's all with the name of Home, and the
>>user selects Home from the dropdown list and does a search, what do you
>>want to happen? Should they find all three? Just one? If just one,
which
>>one?
>
>Well the search at the moment is finding what I want, all three from any
one
>of the Home's (navPageNames) in the drop down list. I just need to get
rid
>of the unwanted Home's from the popup.
>Yeah, but basically everything else works fine.
>
>Jonathan
>
>Ps. Arturo, can you clarify this a bit more please:
>redesign so that the user
>can easily distinguish amongst pages?
>
>For example: Say you have three pages named "Home" but the path to them
are
>distinct such that
>Home1's path is http://ROOT/~u1/HOME
>Home2's path is http://ROOT/~u2/HOME
>Home3's path is http://ROOT/~admin/HOME
>
>then maybe you can display distinct paths?
>
>>
>>
>>Chuck
>>
>>
>>At 12:54 AM 04/03/2003 +0000, Jonathan Fleming wrote:
>> >Chuck, it didn't work but this I think is my fault again in my
>>explaination,
>> >see reply to Art's comment in text body
>> >
>> >
>> >
>> >
>> >
>> >
>> >>From: Art Isbell <email@hidden>
>> >>To: email@hidden
>> >>Subject: Re: DistinctRows
>> >>Date: Mon, 3 Mar 2003 13:43:46 -1000
>> >>
>> >>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.
>> >
>> >Well, you were right that it did't work and all I can do here is
explain
>>how
>> >the EOModel is set up:
>> >TBNavPage has 4 Attributes, 1) navPageName (String 2) navPageContent
>> >(Object) 3) status (String) 4) visibility (String)
>> >
>> >The Entity has no relationships to any tables in the database/EOModel.
>>It's
>> >stand alone.
>> >
>> >>I suspect only the attribute bound to the popup button's
displayString
>>key
>> >>is not distinct.
>> >
>> >yes, this is what is listing duplicate page names as stated. Does this
>>make
>> >it any clearer for a solution.
>> >
>> >>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?
>> >
>> >I don't know what... give me an idea
>> >
>> >Jonathan
>> >
>> >_________________________________________________________________
>> >It's fast, it's easy and it's free. Get MSN Messenger today!
>> >http://messenger.msn.co.uk
>> >
>> >
>>
>>--
>>
>>Chuck Hill email@hidden
>>Global Village Consulting Inc. http://www.global-village.net
>
>
>_________________________________________________________________
>It's fast, it's easy and it's free. Get MSN Messenger today!
>http://messenger.msn.co.uk
>
>
--
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.
_________________________________________________________________
Overloaded with spam? With MSN 8, you can filter it out
http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059
_______________________________________________
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.