Last updated June 22, 2011. Created by xstatic on June 22, 2011.
Log in to edit this page.
Many people have stated that Computed Field will not work with Flexifield.
This example shows how to make it work and get a sum of multiple values from a Flexifield's sub-field.
Assuming 'field_my_flexi' is your Flexifield name, and that you have it set to allow multiple entries; and that you have a sub-field called 'field_flexi_price', and you want to get the sum of all prices for that Flexifield...
Computed Code:
$value1 = $node->field_my_flexi[0]['value']['field_flexi_price'][0]['value'];
$value2 = $node->field_my_flexi[1]['value']['field_flexi_price'][0]['value'];
$value3 = $node->field_my_flexi[2]['value']['field_flexi_price'][0]['value'];
$value4 = $node->field_my_flexi[3]['value']['field_flexi_price'][0]['value'];
$node_field[0]['value'] = $value1 + $value2 + $value3 + $value4;Display Format:
$display = $node_field_item['value'];Data Type: varchar
Date Length: 5