Filter on aggregated date field incorrect

Created on 8 November 2020, over 3 years ago
Updated 3 December 2023, 7 months ago

Problem/Motivation

A Filter on a Date field which has been aggregated using the MAXIMUM function does not recognise that the result is a date, and does not allow date expressions such as '1 year ago'.

Steps to reproduce

I have a query which searches for instances of EntityA, which has a relationship to none or more instances of EntityB. I wish to select only those EntityA which do not have an EntityB with a particular Date field greater than 1 year ago.

I can aggregate on EntityA Id, and set the Date field on EntityB to use the MAXIMUM aggregation function. That's fine and shows the latest related date correctly. I can define a Filter on the MAX Date field, but this does not show the date-related options that one gets when filtering a date field without aggregation. If one sets the filter to 'Less than' and '1 year ago' or '-1 year' it creates a HAVING clause but passes the date expression straight through to the SQL comparison as a literal, which of course does not work.

Proposed resolution

Views Filters should recognise that appropriate aggregation functions on a Date field return Dates, and provide the same filtering options as non-aggregated dates.

πŸ› Bug report
Status

Active

Version

3.24

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024