thanks. I have updated everything , re-wrote the code with the following, but receiving an error message now
"aggregates"=>array(
// "sum"=>"CloseCommAdjCurrency",
"sum" => "number_of_days",
"count"=>"number_of_days",
"avg" => "CloseCommAdjCurrency"
),
"computations" => array(
"tour_weight"=>"{number_of_days - sum} * {number_of_days - count}",
VIEW:
"measures" => array(
'number_of_days - sum',
'number_of_days - count',
'CloseCommAdjCurrency - avg',
"tour_weight"
),
"showDataHeaders" => true,
'headerMap' => array(
'number_of_days - sum' => 'totalDays',
'number_of_days - count' => 'NumberofDaysCount',
'CloseCommAdjCurrency - avg' => 'Avg Comm',
"tour_weight"=> "tour_weight"
),
'columnSort' => array(
'financial_year' => function ($a, $b) {
return (int)$a > (int)$b;
},
),
ERROR:
str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string
foreach ($computations as $computationName => $formulaOrFunc) { if (is_string($formulaOrFunc)) { $formula = $formulaOrFunc; // echo "row = "; print_r($row); echo "<br>"; foreach ($row as $k => $v) { $formula = str_replace('{' . $k . '}', $v, $formula); } // echo "formula = $formula <br>"; $this->data[$dn][$computationName] = $evaluator->execute($formula); } else if (is_callable($formulaOrFunc)) { $func = $formulaOrFunc;
second line:
str_replace('{column}', array('financial_year' => '{{all}}'), '5127 * 959')
3rd line:
$this->processAggregateComputations();
thank you