Fields created with Views PHP cannot be aggregated.

Example: In View based on node there's a NID field. I'm adding a 2nd field (Views PHP) with:

Value code: return ($row->nid % 2) ? 0 : $row->nid; // Show even NIDs or zero.
Output code: <?php print $value; ?>

Field looks OK but after turning ON aggregation and set the aggregation to SUM on both columns, both will show the SUM of all NIDs... The Views PHP field should show the SUM of even NIDs.

Comments

patchshorts’s picture

Confirmed this is a problem. Out put code can be return 1; and you set aggregation to on and the field to count, the whole table disappears for me.

quickly’s picture

I am having similar issue... PHP is giving the right output but when aggregation is turned on there is no aggregation...

quickly’s picture

just checked the forums of Views Calc... Views Calc and Views php are not compatible... views calc generates queries on database, it cannot perform aggregation for any custom/global field..

quickly’s picture

Issue summary: View changes

Small fix on the code comment.