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.
After setting the view throws the following notice:
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 z /home/srv/www/site/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: stdClass::$unknown in views_calc_table_total() (line 258 z /home/srv/www/site/sites/all/modules/views_calc/theme.inc).
Notice: Undefined property: stdClass::$unknown in views_calc_table_total() (line 258 z /home/srv/www/site/sites/all/modules/views_calc/theme.inc).
Comment | File | Size | Author |
---|---|---|---|
#14 | views_calc_1548552.patch | 506 bytes | a.milkovsky |
#12 | views_calc_excluded_totals.patch | 740 bytes | jurgenhaas |
#9 | views_calc_aggregate_fix-1548552-9.patch | 3.57 KB | superspring |
#7 | views_calc_field_max_chars.PNG | 24.68 KB | lunk rat |
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedNot enough information to reproduce the messages. I don't see these messages. Make sure you are using the very latest code. If you are, I need steps to reproduce on a clean install. In other words assume I have no idea what is in your view or what kind of fields you have set up and you have to explain to me exactly how you got to the place where you see this.
Comment #2
tregeagle CreditAttribution: tregeagle commentedI had the same error and resolved it by ensuring the, "Link this field to the original piece of content" tickbox was cleared in the field that was being calculated.
Comment #3
rahimvirani CreditAttribution: rahimvirani commentedI have the same problem but cannot resolve.
1. enabled module
2. changed existing view from type table to views calc table
3. marked one field as sum in settings
result:
sum row with no amount and following error
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /var/www/gdt/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /var/www/gdt/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /var/www/gdt/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /var/www/gdt/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /var/www/gdt/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: view::$row_index in views_handler_field->get_render_tokens() (line 1355 of /var/www/gdt/sites/all/modules/views/handlers/views_handler_field.inc).
Notice: Undefined property: stdClass::$users_field_data_field_beneficiary_uid in views_calc_table_total() (line 259 of /var/www/gdt/sites/all/modules/views_calc/theme.inc).
Notice: Undefined property: stdClass::$unknown in views_calc_table_total() (line 259 of /var/www/gdt/sites/all/modules/views_calc/theme.inc).
Notice: Undefined property: stdClass::$sum__field_data_field_request_amount_donation_request_entity_type in views_calc_table_total() (line 275 of /var/www/gdt/sites/all/modules/views_calc/theme.inc
Comment #4
rahimvirani CreditAttribution: rahimvirani commentedfixed my issues by
1. near line 270 in theme.inc, when ($field->aliases['entity_type']) is used, '_type' must be removed from value for ext_alias: $ext_alias = strtolower($calc) . '__' . str_replace("_type", "", $query_alias); This is because the member in the totals object does not have this suffix.
2. near line 260 in theme.inc, had to check if var is set before assignment: if(isset($totals->{$query_alias}))
$baserow->{$query_alias} = $totals->{$query_alias};
3. near line 312 in theme.inc, changed double var ref to single: $$decimal to $decimal.
4. near line 90 in theme.inc, had to set member ' $view->row_index = "";' as view requires it when using token vars.
Comment #5
dealancer CreditAttribution: dealancer commentedI have same issues. I am using it for in views for custom entity type.
Comment #6
lunk rat CreditAttribution: lunk rat commentedI also have this issue, only on certain fields. I can't see what makes these fields different.
In my views_calc table, about 10 of 15 fields actually display total, and the rest raise the error.
The changes outlined in #4 solve most of my errors. But when I change this line (around 273-4):
$ext_alias = strtolower($calc) . '__' . $query_alias;
to this:
$ext_alias = strtolower($calc) . '__' . str_replace("_type", "", $query_alias);
Then the other 5 fields start displaying totals; however, now the previous 10 fileds (that worked before) are throwing the error and not totalling. So it's one or the other :(
I still don't know what triggers this. The only difference I can tell is that the fields that like
$ext_alias = strtolower($calc) . '__' . str_replace("_type", "", $query_alias);
have longer field names. Otherwise they seem to be exactly the same.Ideas welcome.
Comment #7
lunk rat CreditAttribution: lunk rat commentedI have confirmed that the difference between the fields that work and the fields that generate
Notice: Undefined property: stdClass::$sum_field_name_blah
is the number of characters in the system field_name: they can be up to 21 characters not including field_Steps to reproduce:
Manually apply the edits outlined in #4.
Create a content type and add two fields with the following system names:
field_111111111111111111111
(21 characters after field_ )field_1111111111111111111111
(22 characters after field_ )Create a simple view with Views Calc table display plugin, add your fields and have views_calc perform a sum on them.
You will see something like the attached screenshot, where the 21 character field displays totals but the other two throw errors and display no totals.
I will try to fix and submit a patch, but I am not really sure why the character length is making a difference.
Comment #8
odegard CreditAttribution: odegard commentedI'm changing status to active, I've got further info on how to investigate this further thanks to lunk_rat.
Indeed it is the length of the field names that are the problem, and I've found a work around but it's far from ideal.
If you have devel you can use dsm to inspect the $totals variable around line 278. You will get a list of objects, inspect any of them and you will see something like this:
Notice the last line where the field name is truncated. I think this explains why #4 only works some times - when the field is exactly 5 bytes too long and not for any other case.
The quick and dirty work around is to check the $ext_alias for the(se) truncated field names and set the name to that in $totals (see above).
Comment #9
superspring CreditAttribution: superspring commentedThis patch applies many fixes that were required to get aggregate summaries working on my site.
It includes the comments from #4 and #6.
Comment #10
kietnguyen CreditAttribution: kietnguyen commentedI manually patched the code since I have other patch from https://drupal.org/node/1570746 to display prefixes and suffixes for calculated row. Somehow, I don't need
$ext_alias = strtolower($calc) . '__' . str_replace("_type", "", $query_alias);
When I applied, my SUM didn't display... and I didn't add "Find which key in $totals is closest to the current" part.... The rest is working and fixes all my notices.
Comment #11
mojiro CreditAttribution: mojiro commentedAlso 'Edit link' field causes the following messages
I do not know thow if this is being caused because I use percona mysql server
Comment #12
jurgenhaasTo me, what happened is that totals were added to the base object for each field, even for the unselected fields. All the rest seemed to be a follow-up error from there. A patch is attached which should resolve this.
Comment #13
jeremyheslop CreditAttribution: jeremyheslop commentedIn reference to the class names being to long I changed the theme.inc file to work for me. This is a quick hack and will fail if you have two long field names with the same beginning characters. This should work as long as your field names are less than 44 characters which will remove the node_entity_type appended at the end all together.
ie:
sum__field_data_field_abcdefghijklmnopqrstu_node_entity_type (27 character field name)
sum__field_data_field_abcdefghijklmnopqrstuvwx_node_entity_t (30 character field name, needs the hack)
sum__field_data_field_abcdefghijklmnopqrstuvwxyzabcdefghijkl (44 character field name, needs the hack and is max name to avoid duplicate entries)
I changed in theme.inc:
to
I'm pretty sure this will work as long as field name (including field_) are less than 44 characters, but more testing is needed.
I also applied the changes above to get rid of the other errors I was having with $row_index.
Thanks to those who posted patches and code changes.
NOTE:
I tried the patch in http://drupal.org/node/1548552#comment-6862242 views_calc_aggregate_fix-1548552-9.patch but it gave a 0 total for me on the fields with long names.
Comment #14
a.milkovskyplease review my patch too.
I added simple check for query_alias and it fixed issue for me.
about "view::$row_index" issue see http://drupal.org/node/1567108#comment-7026494
Comment #15
manuelBS CreditAttribution: manuelBS commentedyes, this patch is neccessary and solves the issue
Comment #16
mwallace001 CreditAttribution: mwallace001 commented#13 worked for me!
Comment #17
czoperek CreditAttribution: czoperek commentedI had a similar problem with errors, helped me patch: http://drupal.org/files/views_calc_aggregate_fix-1548552-9.patch thanks. view calc but still do not want to count, for example, the sum of the indicated fields
Comment #18
Stan Turyn CreditAttribution: Stan Turyn commented#14 patch works.
Comment #19
Taxoman CreditAttribution: Taxoman commentedComment #20
rsvelko CreditAttribution: rsvelko commented#14 works
and also the link in there to a patch works too
Comment #21
otcassetmgmt CreditAttribution: otcassetmgmt commentedI would like to install this patch, but I have never installed a patch? Do I simply copy this code and paste it somewhere?
Comment #22
froboyhttps://drupal.org/patch/apply. Bookmark it.
Comment #23
jyee CreditAttribution: jyee commentedpatch in #14 is good.
Comment #24
jyee CreditAttribution: jyee commentedComment #25
Norberto Ostallo CreditAttribution: Norberto Ostallo commentedI confirm that patch #4 works fine.
Comment #25.0
Norberto Ostallo CreditAttribution: Norberto Ostallo commentedReview
Comment #26
News4u CreditAttribution: News4u commentedI applied #17 everything works fine but new error
Warning: number_format() expects parameter 1 to be double, string given in views_calc_table_total() (line 333 of /[path]/modules/views_calc/theme.inc).
I applied patch #17
Comment #27
News4u CreditAttribution: News4u commentedFixed.. totally
I rremoved all prefix/suffix in Global Math expression
If suffix/prefix is added ,, then problem arises
Comment #28
News4u CreditAttribution: News4u commentedSuggestion ..
Views_calc module should be able to calculate/totaling Global Math expression column
Global Math expression only sum rows , so TOTAL SUM ROW should include the aggregate of all values in the Global Math expression column
Comment #29
News4u CreditAttribution: News4u commentedSuggestion ..
Views_calc module should be able to calculate/totaling Global Math expression column
Global Math expression only sum rows , so TOTAL SUM ROW should include the aggregate of all values in the Global Math expression column
Comment #30
KarenS CreditAttribution: KarenS commentedThere is another issue about prefix suffix creating problems, there is another issue about the edit link, and the notices should be fixed in dev now.
Comment #31
KarenS CreditAttribution: KarenS commented