⛓ Formula Composition
Create a new Formula
from a list of Formula
.
Result of previous Formula
computation is used as parameter for the next one. So you can chain multiple operations.
Examples
$result:=formula_compose (Formula($1+1);Formula($1+2)).call(Null;0) // (0 + 1) + 2 = 3
// or using collection
$formulas:=New collection(Formula($1+1);Formula($1+2)) // add one then add 2
$result:=formula_compose ($formulas).call(Null;0) // (0 + 1) + 2 = 3
Assigning to an object
$operation:=New object("compute";formula_compose ($formulas))
$result:=$operation.compute(3) // (3 + 1) + 2 = 5
more in formula_compose