This patch adds three new options to the list handling dropdown in the views field settings form namely:

  • Sum: provides the numerical sum of the data (can be used for example calculating totals).
  • Min: show the minimum of the data in the list.
  • Max: show the maximum (I use it for example to calculate the last date of a date field in the index - for the current record).
Members fund testing for the Drupal project. Drupal Association Learn more


drunken monkey’s picture

Good idea!

However, I'm sorry but after taking a look at the method (my code, not yours), I just can't stand keeping it that way. Please review the attached patch with this feature, some refactoring and a completely unrelated fix for the entity field handler.
Again, sorry. ;)

drunken monkey’s picture

Project: Search API » Entity API
Status: Needs review » Needs work

The Entity API is now responsible for the field handlers – but this is still a good idea (in my opinion). We'd just need to update the patch (if this would be approved by fago).

drunken monkey’s picture

Just tried to implement this for the Entity API, but had to realize that list handling for entity-valued fields is broken anyways (at least when using count or first, and the new ones would have had similar problems). Field API fields have their own mechanism and other kinds of fields are a pain to add for testing.
So, we should probably first fix the existing method, and then implement this analogously.

NWOM’s picture

Issue summary: View changes

Since this issue is a bit older, was wondering if anyone came up with a solution or is this perhaps integrated somehow? Since standard views aggregation does not work, and since the Views Calc module appears to not be compatible with Search API, I'm still on the search for an available option.

Thanks in advance!