What is the correct way to do this with rules?

<?php
$meters = '[node:field_track_distance]';
$seconds = '[node:field_track_time]';
$kmh = $meters / $seconds * 3.6;
print round($kmh, 2);
?>

If I just want to save a token value <?php print '[node:field_track_distance]'; ?> it works fine but as soon as I try to do anything else with the tokens I just get 0 saved. I am doing this with "set a data value'.

Thanks.

Comments

hampshire’s picture

Issue summary: View changes

fixed code typo

TR’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

If you continue to have a problem with this in the current version of Rules please open a new issue.