I have three fields in a content type and want to calulate sum of them in another field. First, I use Computed Field but it does not work at all. Then I tried to use conditional field but it is not made for this purpose at all. So I am trying rules module and make an event: After saving new content(or before) - The condition is: Content is of type [something] - The action: Execute custom PHP code.
And the code is:
$field_a = field_get_items($entity_type, $entity, 'field_absence'); $field_b = field_get_items($entity_type, $entity, 'field_delay'); $field_c = field_get_items($entity_type, $entity, 'field_vacation'); [node:field-sum] = $field_a['value']+$field_b['value']+$field_c['value'];
But it does not do anything at all. I used the same code in computed field but it has no result. I'm not an expert Drupal programmer. So I need your helps in it. Thanks in advance.