0

I have a view that filters two content-types (single event, and serial event) by date. The content-types have their own date-field (one with, one without date-repeat option).

The view shows all the "serial events" first, and afterwards the "single events".

How can I change this order?

Is it because I use two different date-fields?

The sort criteria are the following:

  • Format
    Format: Unformatted list | Settings
    Show: Fields | Settings
  • Fields
    Content: single event
    Content: serial event
  • Filter criteria
    Content: Published (Yes) AND Content: Category (exposed) | Settings AND Content: Type (in single event, serial event) OR Date: Date (node) (Content: single event (field_serialevent) OR Content: serial event (field_singleevent) >= now)

I am using Drupal 7.14, with the latest versions development snapshots of the Views, Calendar, and Date API modules.

  • What's the sort criteria? – Tyler Durden May 30 '12 at 11:26
2

Are you sure you are only have one sort field? It sounds like you are also sorting on "Type". If you are sorting on type, make sure the "Date" is the first in the sort fields. The order of the sort fields, makes the top ones dominant.

  • No, i had just the Date field to sort. But after removing this sort field completely i had the order i wanted... Thanks for explaining the "order"-relationship... – Volker May 30 '12 at 11:42
0

In case anyone comes across this looking for sorting on two different date fields, please see the summary of possible solutions I wrote here: https://drupal.org/node/2133879

The best solution I found was to use hook_views_query_alter() function to alter the sort criteria to use a CASE ... WHEN conditional in the orderby filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.