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).

Comments

StatusFileSize
new4.19 KB

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. ;)

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).

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.