Doing sum, avg, min or max on an integer or float field gives empty result.

Applyng this patch seems to solve the problem:

diff --git a/modules/field/views_handler_field_field.inc b/modules/field/views_handler_field_field.inc
index 087b559..ded6fdb 100644
--- a/modules/field/views_handler_field_field.inc
+++ b/modules/field/views_handler_field_field.inc
@@ -709,12 +709,7 @@ class views_handler_field_field extends views_handler_field {
       $entity->{$this->definition['field_name']}[$langcode] = $new_values;
     }
 
-    if ($field == 'entity') {
       return $entity;
-    }
-    else {
-      return $entity->{$this->definition['field_name']}[$langcode];
-    }
   }

Please see also issue #1192242: Fatal error: Unsupported operand types after update to 7.x-3.0-rc1

CommentFileSizeAuthor
#10 1194900-field-groupby.patch972 bytesdawehner
#5 patch.diff554 bytesxlyz

Comments

Countzero’s picture

This patch solves the issue, but raises others (in my case, a weird 'too much recursion' JQuery error), which is normal, as the function doesn't return anything despite the fact it's supposed to.

I temporarily changed the code to a mere :

return $entity;

... which is probably terribly wrong but seems to work for my present use case, mean, without raising obvious issues as of now.

xlyz’s picture

not meant to be picky, but it actually did return $entity also in my patch ;)

dawehner’s picture

As long you don't have a .patch file, that's not a realy patch :)

Countzero’s picture

Yeah, sorry : I was a bit quick on the copy/paste side o_O.

Please excuse me for the unneeded noise.

xlyz’s picture

StatusFileSize
new554 bytes

@dereine

here it is :)

dawehner’s picture

Status: Active » Needs work

Not sure whether this is really the way to fix the problem...

Why should it not allow to return the raw value instead of the full entity?

hartogsmith’s picture

this was vexing me--thanks for the patch.

dandaman’s picture

This doesn't seem to me to be a solution. It seems to me to be more of a workaround than a solution. I mean, it seems that if you're using aggregation it doesn't display the data right (and returns a host of notices). This fixes the problem but I think also introduces another bigger set of problems. Unfortunately, I don't have enough Views ninja skills to know how to fix this, but hopefully someone will be able to troubleshoot this. It did not give me these notices and missing values on earlier beta versions of Views.

dandaman’s picture

Interesting: I found this code was committed here just a couple weeks ago: http://drupalcode.org/project/views.git/commitdiff/340d3f3376688d201b4e6...

It seems that this commit doesn't work with the Aggregation/Grouping feature.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new972 bytes

Here is a patch which solves the issue for me.

dawehner’s picture

Status: Needs review » Fixed

Commited because the test worked for someone on IRC and for me.

xlyz’s picture

work for me as well

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

thriggs’s picture

Status: Closed (fixed) » Active

This patch seems to have some issues working with Node reference relationships. It works fine when setting it to SUM a field, but when I add a node reference relationship to the field, I get the following fatal error:

"Fatal error: Cannot access empty property in /home/riggss5/public_html/modules/field/field.attach.inc on line 317"

which prevents me from editing the view. Am I doing something wrong?

thriggs’s picture

Priority: Major » Minor
Status: Active » Closed (works as designed)

I apologize for that... I was configuring views incorrectly.

Pun-1’s picture

I am having this issue - but I have rc3 - do I still need this patch?