Module Description
As the Views and Views Calc modules rely on the database to perform aggregation, you only have limited options at your disposal. As the great Merlin himself said: "You can't aggregate a PHP expression in the database.  :/ ". That's where Views Aggregator Plus comes in. In addition to what Views and Views Calc do, this module:


* enumerates group members
* produces tallies, i.e. textual histograms
* aggregates on Views PHP code-snippet evalutations
* can filter out result rows on regexp patterns
* gives you sorting on Views' Math expressions
* can process Webform submissions
* lets you add your own custom aggregation functions

... and it puts summary statistics at the bottom of your aggregated table as well!

Recap: what is aggregation again?
In the context of Views tables and this module, aggregation is the process of grouping and compressing result rows on the identical values of one column, while at the same time applying "summary" (aggregation) functions on other columns. For example, you can group the result set on a taxonomy term, so that all rows sharing the same value of the taxonomy column are represented as single rows, with aggregation functions like COUNT, ENUMERATE or SUM applied to the remaining columns.

Example Say the original View based on raw database results looks like below.

Industry Company Name Turnover IT AquiB $  25,000,000 Clothing Cenneton $  99,000,000 Food Heiny $  66,000,000 IT PreviousBest $    5,000,000 Food McRonalds $500,000,000

Then with the grouping taking place on, say Industry, and aggregation functions TALLY, ENUMERATE and SUM applied on Industry, Company Name and Turnover respectively, the final result with a descending sort on the last column will display like below. Note that the module identified three groups. It also added a totals row, Views Calc style.

Industry Companies Turnover Food (2) Heiny, McRonalds $566,000,000 Clothing (1) Cenneton $  99,000,000 IT (2) AcquiB, PreviousBest $  30,000,000 Totals             5 $695,000,000

But that's just the beginning. Remember, you can aggregate on Views PHP expressions, so the possibilities are endless! See the README for examples using PHP code snippets.

For the "totals" row you may use the module's Math expression column aggregation function and replacement tokens to calculate a field as, say, the product of two preceding fields.

How to use
On the main Views UI page, admin/structure/views/view/YOUR-VIEW/edit/page, under Format, click and instead of Table, click Table with aggregation options. Having arrived at the Settings page, follow the hints under the header "Style Options".

More examples
A live example using lots of columns and rows, as well as exposed filters: Vizala, see this blog post. Three other real-life applications with screenshots are in this article: "But that's easy in Drupal isn't it?"

FAQ's
Q: With Views Aggregator Plus installed, is there a reason to use the Views or Views Calc aggregation options? A: Views Aggregator Plus has all the standard aggregation functions of Views and Views Calc (COUNT, SUM, AVERAGE, MIN, MAX), plus more. For huge datasets the native db functions employed by Views and Views Calc are possibly a little faster in execution than Views Aggregator Plus's post-query approach, but I have to see evidence that it's noticeable.

Q: As a developer can I add more aggregation functions in a maintainable fashion? A: You can write your own mini-module for this in which you implement hook_views_aggregation_functions_info(). It's easy. See how it was done for the included submodule, views_aggregator_more_functions.module and follow the same pattern.

Works great with:

* Webform 7.x-4.x: aggregate your webform submission results tables
* Drupal Commerce, see bottom screenshot. Group and compress was applied to the Order Status field. # Orders was counted and the Totals field Summed, while a textual histogram with counts (Tally) was executed on the User name. Column aggregations were added also for #Orders and Totals, displayed in the bottom row.
* Table Trash, responsive table options as well as buttons to export to CSV, PDF
* HighchartTable: add charts to your aggregated tables with a single click
* Views Field View, see #2341379: Intermediary Sum

Project Usage
13016
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to enhance the aggregation capabilities of Views by allowing for grouping, compressing, and applying summary functions on result rows based on identical values in a specified column.
Data Name
views_aggregator

OPENAI CHATBOT

OPENAI CHATBOT

14:27:57
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.