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
Comments
Comment #1
Countzero commentedThis 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.
Comment #2
xlyz commentednot meant to be picky, but it actually did return $entity also in my patch ;)
Comment #3
dawehnerAs long you don't have a .patch file, that's not a realy patch :)
Comment #4
Countzero commentedYeah, sorry : I was a bit quick on the copy/paste side o_O.
Please excuse me for the unneeded noise.
Comment #5
xlyz commented@dereine
here it is :)
Comment #6
dawehnerNot 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?
Comment #7
hartogsmith commentedthis was vexing me--thanks for the patch.
Comment #8
dandaman commentedThis 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.
Comment #9
dandaman commentedInteresting: 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.
Comment #10
dawehnerHere is a patch which solves the issue for me.
Comment #11
dawehnerCommited because the test worked for someone on IRC and for me.
Comment #12
xlyz commentedwork for me as well
Comment #14
thriggs commentedThis 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?
Comment #15
thriggs commentedI apologize for that... I was configuring views incorrectly.
Comment #16
Pun-1 commentedI am having this issue - but I have rc3 - do I still need this patch?