• 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: EOFetchSpecification - sorting by partial date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOFetchSpecification - sorting by partial date


  • Subject: Re: EOFetchSpecification - sorting by partial date
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 13 Jul 2015 18:20:54 +0000
  • Thread-topic: EOFetchSpecification - sorting by partial date

Just a note that you can use the  extract (year from theDate) and extract (month from theDate) in a derived column in EntityModeler which avoids the need for a view.

On 2015-07-13, 11:16 AM, "Theodore Petrosky" wrote:

you didn’t mention your database, but I have done things like this with a view.

I created a view with the appropriate columns and in the select statement I put in the order by

CREATE OR REPLACE VIEW myNewView AS SELECT info1, info2, theDate FROM theTable ORDER BY extract (year from theDate) desc, extract (month from theDate) asc;

A one point I actually set up some rules to make the ‘VIEW’ updatable.

YMMV obviously depending on you access to the backend, and if Views are supported.

Ted


On Jul 13, 2015, at 12:02 PM, Calven Eggert <email@hidden> wrote:
Hi, All
I have a fetch that sorts records by three columns where one of the columns is a date (timestamp).  Is there a way to sort the date by month & year only?  
Thanks,
Calven
Here is the current fetch:
...
EOSortOrdering sortBySource = new EOSortOrdering("source", EOSortOrdering.CompareCaseInsensitiveAscending);
EOSortOrdering sortByAppt = new EOSortOrdering("appointmentDate", EOSortOrdering.CompareCaseInsensitiveAscending);
     EOSortOrdering sortBySite = new EOSortOrdering(“site", EOSortOrdering.CompareCaseInsensitiveAscending);
     NSMutableArray orderings = new NSMutableArray();
     orderings.addObject(sortBySource);
     orderings.addObject(sortByAppt);
     orderings.addObject(sortBySite);
EOFetchSpecification spec = new EOFetchSpecification(“records", qual, orderings);
_______________________________________________
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


_______________________________________________
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
 _______________________________________________
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

  • Follow-Ups:
    • Re: EOFetchSpecification - sorting by partial date
      • From: Theodore Petrosky <email@hidden>
References: 
 >EOFetchSpecification - sorting by partial date (From: Calven Eggert <email@hidden>)
 >Re: EOFetchSpecification - sorting by partial date (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: EOFetchSpecification - sorting by partial date
  • Next by Date: Re: EOFetchSpecification - sorting by partial date
  • Previous by thread: Re: EOFetchSpecification - sorting by partial date
  • Next by thread: Re: EOFetchSpecification - sorting by partial date
  • Index(es):
    • Date
    • Thread