I spent a few hours this evening trying to get my View to cease displaying a table row for each instance of a Date-and-Time value (both start and end).

After coming across various posts suggesting solutions involving Aggregation and Query settings in the Advanced view settings, it turns out the solution was much simpler.

Here is the situation:

I have a series of events to post on my site and was using Views to create a tabular list of them, displaying only certain fields. All of the events use at least one (required) date with a different Start and End time (but it could be different Start and End dates -- doesn't matter). But some of the events occur, for example, on both a Saturday and Sunday of a week, hence the additional dates and times entered in the node (the date field properties allowed multiple values -- in fact, this is the only field with multiple values in the node, so I could not figure out why I couldn't get this to work).

When I first built the View, the 2-date event (node) was appearing twice, with both dates displaying each time.

What I really wanted was the node to appear only once with both dates listed.

At first, I un-clicked "Display all values in the same row" under the "Multiple field settings" in the date field settings. This resulted in the node continuing to appear twice, but the first instance/row displayed the first date/time and the second instance/row displayed the second date/time. This was workable, but not really what I wanted, since I knew later in the year I would have a similar situation with not just 2 but 6 to 8 instances of the same event/node, and I did not want to see the same node six or eight times as I scrolled down the page.

I then spent a lot of time slogging through posts about Aggregation and Contextual filters (so help me it will be a miracle if I ever get to the point where I understand Context in Drupal...) adjusting those settings and usually breaking the query, probably because I don't really understand the aggregation parameters in the field settings well enough.

After a few hours of this, I decided to take a break, log off and rest my brain.

Almost immediately the solution came to me.

Simply add an additional Filter Criteria setting the [dates field]:delta Equal to zero (0)!

It hadn't occurred to me to use the 'delta' filter option because I had already set a filter based on the particular date field's End date.

After setting the additional filter, I re-ticked "Display all values in the same row" in the field settings, and I got exactly what I wanted!

Drupal core 7.34
Views 7.x-3.10

Comments

maenjuel’s picture

Worked for me, thanks for the solution!

museumboy’s picture

This is a nice start, but the event will fall off the list once the first date in the series passes. I filter start dates by selecting >= to now as a relative date. Once I add the delta field only events that have all dates in the future will display. Nothing I do seems to change this.

There is a module called Views_distinct which seems to work for me. I wish it less heavy handed though.

jaims-dev’s picture

You are right; when the first date is before now, the event falls out of the list.

I have the same problem :-( 

Maybe time to pay a visit to the views_distinct module, which I have never used before.

Thanks for the hint!

*Edit: I am on D8 and have just found that views_distinct has not been updated to work with it :-(

stuhannaford’s picture

BIG help, thank you! Had a similar issue with multiple sections being displayed via the Paragraphs module. Just wanted ONE copy of the node to be displayed. A filter of delta zero did the trick!

mlecha’s picture

Nice.

lincoln-batsirayi’s picture

Also works in D8!