Re: Custom EOSortOrdering for a WODisplayGroup
Re: Custom EOSortOrdering for a WODisplayGroup
- Subject: Re: Custom EOSortOrdering for a WODisplayGroup
- From: Mark Wardle <email@hidden>
- Date: Thu, 6 May 2010 13:13:02 +0100
I've done this for broken legacy data.
My getter does more than a simple cast - it returns the number from
the string with non numerical digits removed. Therefore it is
guaranteed to return a numerical value.
In fact, because my hosipital identifiers frequently have letters
before and after, to deal with sorting I convert the letters to two
numbers which are subsequently converted to the moat or least
significant numbers. As such. A00002 comes before B00001 and most
importantly, A00010 comes after A00005!
--
Dr. Mark Wardle
Specialist registrar, Neurology
(Sent from my mobile)
On 6 May 2010, at 12:21, Paul Hoadley <email@hidden> wrote:
Hi Mark,
On 06/05/2010, at 8:33 PM, Mark Wardle wrote:
This may be naive but could you create a derived property and sort
on that?
Presumably this could be java based for in memory sorts or
implemented within your database if db sorts were required?
That's what I am doing as a work-around while the identifiers are
known just to contain numbers (in a string attribute). I just cast
the strings to integers, and sort in the conventional way. That
will break if and when the attribute contains a value that can't be
cast to an integer. I suppose I could extend that: instead of
casting to an integer, pad the strings with '0's. In any case, I
just wondered if there was a more WO way to do it, but I suspect I
misunderstood how EOSortOrderings worked, as I described in my
previous post.
--
Paul.
http://logicsquad.net/
_______________________________________________
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