Would it be possible to add an action interface to the computed field module so that together with the Drupal 6 Rules Module it would be possible to update computed fields when executing an action?

My example is the following:
- project CCK node type contains information and parameters about a project to be done
- bid CCK node type contains information about a bid for a specific project
- bids are children (e.g. node hierarchy) of the projects; each project can have multiple bids
- the project should have some calculated fields like e.g. lowest bid, which is stored in the database so that it is accessible with views

Now, when a new bid is submitted by a user, the "lowest bid" field for the corresponding project should be recalculated, updated and stored.

I envision that this would work quick nicely with the rules module when you can specify events and conditions. When these are met, then actions of modules can be executed. Would such an action of computed field not fit in here quite nicely? The computed fields could then be updated based on updates of other nodes. Since computed values may often depend on other nodes than the one on which the computed field is show, I imagine that this would be quite useful.

(This would probably also solve the issue of the other poster http://drupal.org/node/314990 that wanted to have access to the rating in the views.)

Comments

Jkello’s picture

choster’s picture

Status: Active » Closed (duplicate)
Uersu’s picture

Status: Closed (duplicate) » Closed (fixed)

In the mean type I have used the rules module to solve this problem.

As mentioned above, in the 'project' content type I have various computed fields (e.g. number of bids, lowest bid). In the 'bid' content type I have a node reference to the project to which the bid applies.

Now I use rules to trigger an action whenever a new bid is submitted. This action will load the project referred to in the bids node-reference. After loading the project it just save the project again thus triggering a recalculation of the projects computed field.

No changes needed to 'computed fields'