Closed (fixed)
Project:
Date
Version:
7.x-2.0-alpha5
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2012 at 17:23 UTC
Updated:
4 Feb 2012 at 06:00 UTC
Hi,
How can I sort views rows by a date field which has multiple values?
My content type has a field type Date with multiple values. I'm trying to build a view using a sort criteria by this date field.
But views rows become duplicated (if a node has 3 date values, this node will appear 3 times). I tried setting query as DISTINCT, but no effect.
Aggregation does work fine with sort, but the field value only returns one value (doesn't matter multiple values settings).
Is there a solution?
thanks
Comments
Comment #1
tim.plunkettSay you have two nodes, 3 values for each.
Node 1
Jan 19 2012
Mar 21 2012
May 22 2012
Node 2
Dec 18 2011
Feb 20 2012
Apr 22 2012
How would you sort these?
Comment #2
carvalhar commentedActually i was trying to output this:
January / 2012
Node 1
Node 2
February 2012
Node 3
Node 4
and so on... its related to this solution:
http://drupal.org/node/317534
Comment #3
tim.plunkett@carvalhar, but using the date values from my comment above, it would output
Dec 2011
Node 2
Jan 2012
Node 1
Feb 2012
Node 2
Mar 2012
Node 1
Apr 2012
Node 2
May 2012
Node 1
Comment #4
carvalhar commentedok, here's my configuration of the main view:
[Fields]
my multiple date field => selected first time to display only month (custom date format)
my multiple date field (2) => selected second time to display only day (custom date format)
my multiple date field (3) => selected third time to display as the grouping field, aggregate all, group column by value, group columns by entity type and value, showing only 'month - year' (custom date format)
my node nid => used as argument for views embed field.
my embed view date list => i had to use Views Field Views to create a list of dates from a view as a embed view in a field. This view simply list all dates from a node nid argument.
[Advanced fieldset settings]
Use aggregation = YES
Distinct = YES
[Sort]
Sorted by my date field (3) with aggregate all results (ASC)
[Format]
Grouping field => my multiple date field (3)
Use rendered output to group rows => checked
That's my solution. And here's the page.
Comment #5
tim.plunkettLooks great, what's the problem?
Comment #6
carvalhar commentedtoday nothing lol
at 02 january it was a problem...
but i couldn't find a way to do this without views embed field
Comment #7
tim.plunkettI'm calling this fixed. You had a complicated use case, and you found a solution. There is no generic way to solve this.