Posted by astanley86 on January 23, 2012 at 11:18pm
2 followers
Jump to:
| Project: | Rules |
| Version: | 6.x-1.4 |
| Component: | Rules Core |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
How do I populate a CCK field that is the difference of 2 CCK field values?
I am able to invoke the $current_points variable but not the $duration_points variable I created..
field_scheduling_hours exists in the user's content profile
filed_calc_duration exists on the node being created. It is a CCK computed field type.
I am executing the following PHP snippet:
// Current user points.
$current_points = $node->field_scheduling_hours[0]['value'];
$duration_points = $node->field_calc_duration[0]['value'];
$new_total = $current_points - $duration_points;
// Remove duration hours from available hours.
return array(
// Rules will make sure the content profile is saved
// after all rules have finished executing.
0 => array('value' => ($new_total)),
);Thank you!
Andrew
Comments
#1
Hi astanley86,
Probably you won't be able to access value of field_calc_duration because is a value from node being created. I guess that you will have to use another solution, other than rules. I don't know the problem, but the simplest would be to create own module.
#2
Updated component.