I am trying to group my results by an entity field value, using "Filter critera". This does not work because I can not select which property (column) to group by when using filter criteria.

If I change my display settings from "node" to "fields", I can add the field I wish to group my results on under fields instead, and configure which COLUMN it should use to group on. Therefore, I can use the "value" column, instead of (what i suppose filter criteria uses) the entity id.

So the problem is that I can not group my results using filter criteria, I need to do it by setting the display type to fields - and adding the field I want to group by.

I'm not sure if this is some perfectly good reason for not allowing selection of the column when using aggregation under filter criteria vs. defining grouping under fields - but would surely like the same options available under filter criteria.

Comments

2xe’s picture

Status: Active » Closed (fixed)

Made a workaround by;

1. Adding the field value to group on using hook_views_query_alter()
2. Tag the query in hook_views_pre_execute()
3. Add group by on the field from (1) in hook_query_alter()