Computed Field is a very powerful CCK field module that lets you add a custom "computed fields" to your content types. These computed fields are populated with values that you define via PHP code.
1. Download the module from http://drupal.org/project/computed_field.
2. Extract and copy the module directory to the sites/all/modules directory on your site.
3. Before you can use Computed Field, you'll need to get CCK and enable (at the very least) the 'content' module. You will probably also want to enable the other cck modules, such as 'text', 'number', 'date', etc.
4. Enable the module.
5. To add a computed field to a content type, go to administer > content > content types, select the content type you want to add to, and click on the 'add field' tab. One of the field types available should be 'Computed', and it should have one bullet point under it, also labelled 'Computed'. If you select this, give your field a name, and submit the form, you will get to the configuration page for your new computed field.
5. In the configuration page you will find two text areas one called Computed Code -- This is the code that will assign a value to your computed field. It should be valid php without the <?php ?> tags.
The other called Display Format -- This is also php code which should assign a string to the $display variable. It has '$node_field_item['value']' available, which is the value of the computed field. It also has '$field' available, and you can call any drupal functions you want to display your field.
6. If for example we do the following :
We will get a computed field with the value of node id multiplied by 5; if node id is 2 then result is 10.
Finally I can say that this module is a very powerful module for dealing with computed calculations, also these calculation can be saved in the database for later using and formatting.
I hope you enjoyed this Module Preview and stay tuned for more to come.
Senior Drupal Developer, JesoX LLC