I am currently trying to figure out how to set a minimum value to a computed field using an if, else statement. I basically want the field to check the value of other fields and if their calculated value is less than 150, set the value to 150. Here's what I'm trying to use unsuccessfully:
if (!$node->nid) {
node_save($node);
}
$min_install = '150';
if ( ($node->field_sf_total[0]['value'] * 10) * $node->field_fab[0]['value'] ) < $min_install {
$node_field[0]['value'] = $min_install;
}
else {
$node_field[0]['value'] = ($node->field_sf_total[0]['value'] * 10) * $node->field_fab[0]['value'];
}
I get syntax errors when using it, so any help pointing out my errors would be greatly appreciated! Thanks!
Comments
Comment #1
fmesco CreditAttribution: fmesco commentedFigured it out:
Comment #2
mmjvb CreditAttribution: mmjvb as a volunteer commented