Let's support some basic math

CommentFileSizeAuthor
#2 rules_calc_ajax.patch762 bytesfago

Comments

fago’s picture

Some thoughts:

* we should add some data processor that can apply some basic offsets to numbers like we have it for dates. We could even support different operations here, but we are limited to apply the operation with a fixed value, e.g. "* 2".
* add a "calculate data value" action that takes two input parameters and provides the result as a new variable. This action is useful even with two dynamic arguments then.

The action should work with numbers and/or durations. Maybe we also want to support moving dates by a given duration?

Given we need the action anyway, I guess it suffices to support just a basic offset for numbers as data processor.

fago’s picture

Component: Rules Engine » Provided Rules integration
Status: Active » Needs work
StatusFileSize
new762 bytes

I've implemented the action + the data processor + committed both.

However, the action configuration form is not optimal yet as it needs to be reloaded if once selects a date as first input. Using the #ajax system with the data selector does not seem to work properly though. For now, I've activated an "Reload form" button, so the action can be configured.

Patch which enables the #ajax-refresh attached. I leave the issue open for fixing the form to work with #ajax reloads.

sepgil’s picture

I've opened a new issue for the reloading form problem: Dynamicly reload parameters depending data selector

fago’s picture

Status: Needs work » Fixed

ok, so let's set this issue to fixed then.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mitchell’s picture

Component: Provided Rules integration » Rules Core

Updated component.