Thanks for all the work on Computed Field. As you say, really powerful.
I do get error reports when doing some chemistry with Computed Field. The following works just fine in a computed field where a function in a custom module is accessing and processing data contained in some other cck fields.
$atomproperty = atoms ("atomnumbers",
$entity->field_group_1['und'][0]['value'] ,
$entity->field_group_1_number['und'][0]['value'] ,
$entity->field_group_2['und'][0]['value'] ,
$entity->field_group_2_number['und'][0]['value'] );However this throws a number of identical errors on previewing and saving a node, all of which are
Notice: Undefined offset: 0 in eval() (line 1 of /...path.../drupal7/sites/all/modules/computed_field/computed_field.module(401) : eval()'d code).
This seems related to the situation where field_group_1, field_group_1_number, and so on, are not required fields, quite properly from a science point of view. The calculation works just fine despite the error messages. If all field_group_1 and so on contain data, there are no error messages.
As a workaround I can work eliminate the messages by making the fields required, making zero or none the default values, and then making sure I ignore those values in my function. However I suspect that, in general, the user should be able to allow cck fields referenced from a computed field to be empty when it makes sense for that to be the case. Therefore would it be possible please for the Computed Field module not to report an error when there are no entries in cck fields that a formula in a Computed Field module requires. Or if I am missing a point somewhere please advise. Many thanks.
Comments
Comment #1
Moonshine commentedIf I'm understanding you correctly you are just seeing PHP warnings when trying to access other cck field values that are not required and there for may not have and data. If that's the case then really you'll just want to account for these "conditional" field values in your PHP code with some additional check statements using something like isset(). Computed Field really doesn't have a way of knowing what variables and fields you're trying to work with, just just executes your code and let you work out the logic, as you know best. :) Moving to support where you'll likely get more help.
Thanks...
Comment #2
colanSee above comments.