A feature that would be helpful in the next version of Rules, would be the ability to make multiple calculations in one action.
For example: Currently I am trying to add values from fields a,b,c,d,e and f. To do this suitably in rules, I have to create an action to add a and b, then another to do c and d, then another for the results of these first two actions and a final to add this result to f.

The ability to be able to do calculations such as this in one action (possibly with the option of setting different operators between values (eg a + b - c / d)) would be incredibly more efficient that having to create so many actions.

Comments

bajanem’s picture

Component: Rules Core » Rules Engine

I agree with this request, I have found it extermely difficult to find modules to perform calculations across diiferent nodes for Drupal 7.

mitchell’s picture

Issue tags: +data transforms

tagging

geek-merlin’s picture

@JennyZoo: if you assign yourself, this means you volunteer to do it - is this what you want?

geek-merlin’s picture

wow, this might be a big gain, but not too easy.
thoughts:
* to check: can an action have a variable number of arguments?
* the code from "views math field" might be a good start for this

nicodv’s picture

Component: Rules Engine » Rules Core

hey, I thought it was me!! I support this idea very much.

Thanks in advance

geek-merlin’s picture

update: we do not need multiple arguments - just use our tokens.

code is easy: from views_handler_field_math::render()

    ctools_include('math-expr');
    // removed token processing, rules does this for us
    $expressions = explode(';', $value);
    $math = new ctools_math_expr;
    foreach ($expressions as $expression) {
      if ($expression !== '') {
        $value = $math->evaluate($expression);
      }
    }
tr’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
Assigned: jennydumitrescu » Unassigned
Issue summary: View changes