Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Can Views do a SUM() aggregation on fields that aren't in the database?
I've tried a lot of techniques, but nothing works. Is it even possible? If so, is there documentation? I can't find any.
This is for a computed Entity property.
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedUnfortunately no, there's no real way to do this with aggregation; you have to have some way to collapse all the records into one. Since it's not in the database you can't even do subqueries.
Instead, what you would have to do is have a handler that works like prerender_list, but instead of displaying the list of records, it aggregates them in memory. That's the only solution I can think of. An example might be user roles.
Comment #2
Ravi Shankar Karnati CreditAttribution: Ravi Shankar Karnati commentedviews is good but my question is how to differentiate the views2 and views3 versions. where can i know which is views2 and views3? Please let me know? Thanks