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.
My computed code is:
$node_field[0]['value'] = $node->field_ask[0]['value'] / db_result(db_query("SELECT field_units_value FROM content_type_deal_apt WHERE nid=%d",$node->field_ask_ref_deal[0][nid]));
It works on some content perfectly. On other content, I get zero with this in the log:
Division by zero in /var/www/drupal-sites/all/modules/computed_field/computed_field.module(138) : eval()'d code on line 1.
Any suggestions on tracking this down?
Comments
Comment #1
Navid19 CreditAttribution: Navid19 commentedI'm receiving the same error. I'm able to still add the content but am a little worried the content is not being added correctly.
Any advice is much appreciated.
Thanks!
Parse error: syntax error, unexpected ')' in /home/...../public_html/sites/all/modules/computed_field/computed_field.module(161) : eval()'d code on line 1
Comment #2
johnthomas00 CreditAttribution: johnthomas00 commentedIt has been a few months now. My current code for this problem loads a referenced node then runs the calculation. This code has been working perfeclty for some time now.
Comment #3
excaliburst CreditAttribution: excaliburst commentedI think it must have something to do with the field types that you use for the calculation in the computed field.
I have one type of content, where divide two integers with no problem.
But then when same calculation in another content type is being done with dividing an integer with a floating point number - I get the above error too.
Any thoughts on mixing field-types in a calculation for computed field?
Best regards
Morten E
Comment #4
mmjvb CreditAttribution: mmjvb as a volunteer commented