Feature proposal #4514
open
Extend substitution usage with further processing features
Added by krileon over 10 years ago.
Updated about 8 years ago.
Description
Currently you can do IF statements or substitute in values, but it's commonly requested to do simple php behaviors or simple math like adding two values together. Would be neat to have something like the following.
[cb:math method="add"][cb_points][cb_rating][/cb:math]
That would for example add the two fields together. Date substitution could be upgraded to support supplying a field so the date being formatted isn't always now. Inline substitutions could also be helpful. For example you supply a math or if substitution inside of a date substitution.
We should definitely discuss the syntax there.
We need something humanly readable and natural.
e.g. instead of:
[cb:math method="add"][cb_points][cb_rating][/cb:math]
we could have:
[cb:formula][cb_points]+[cb_rating][/cb:formula]
or something even easier to read:
[cb_points]+[cb_rating]
The "IF" logical maths implementation could be a nice base.
I agree with [cb:formula][cb_points]+[cb_rating][/cb:formula] as that's most familiar to our current usages. CB Auto Actions already has parsing code for this as well so it's absolutely doable.
- Target version changed from CB 2.1 to CB 3.0
This can be provided by CB Auto Actions now via the trigger. Can be added as core functionality with CB 3.0 once the substitutions API has been further rewritten.
Also available in: Atom
PDF