Pages::calculate($formula[,$decimals])

Version 3.8

Calculate given formula for all pages

Calculate given formula for all pages with Page::calculate() and return the goal sum.

Calculate given formula and return result. Fieldnames are replaced with fields Field::getNumber() -value.

Return value

Float

Arguments

$formula
Calculation where field names are replaced with field values.
Subfield values can be referenced by: field.subfield.
Subrow sums can be referenced by: [fieldname: subfield]
$decimals
Number of decimals in return value
Default: 2

Example

Count sum of total VAT of every order row:

$totalVat = $this->get('page','order',$id)->order_rows->calculate('amount*product.price*0.24');