0

I have two footers in a view page with the sum results from View Aggregate Plus (VAP). The last row is the sum result.

footer A:
var A
10
20
30 (sum result from VAP)

footer B:
var B
25
30
55 (sum result from VAP)

I would like to sum the results of footer A and footer B (Total =20 + 30), using global php (module view php).

The available variables below: enter image description here

What is the output code to get the total summation result ?

3

What you are trying to do is to use module in alpha version (bad practice) that keeps PHP code in database (very, very bad practice) for task that can be accomplished by modules without these flaws, like Views Calc, Views Aggregator Plus or even built-in aggregation.

My current favourite is Views Aggregator Plus:

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 example on it's page is quite similar to what you want to accomplish here.

For a whole table sum, just add Global: mathematical expression column to sum values in row, and then Views Aggregator Plus to sum that column. Column may be hidden, for example with CSS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.