D'Arcy Norman has a Computed Field example in which he calculates the average speed of a bike trip, rather than filling it in manually:
Computed Field settings (leaving other fields at their defaults):
- Computed Code:
$node_field['value'] = ($node->field_distance['value'] / $node->field_duration['value']) * 60;
- Check 'Store using the database settings below
- Data Type: float
- Data Length: 10,2
- Default Value: 0
- Check 'Sortable' to make the field sortable in views.
The end result can then be displayed in a sortable view.