Need some help with a calculated column and percentages. Here is my code:
class TestReport extends \koolreport\KoolReport {
use \koolreport\clients\Bootstrap;
public function settings()
{
//Get default connection from config.php
$config = include "../config.php";
return array(
"dataSources"=>array(
"test_report"=>$config["query_source"]
)
);
}
protected function setup()
{
$this->src('test_report')
->query("SELECT
localtestdate,
COUNT(`localtestdate`) as 'Total_Tested',
count( case when `board_p_f`='p' then 1 end) as Pass,
count( case when `board_p_f`='f' then 1 end) as Failed
FROM tblpass5bevent
group by `localtestdate`,`board_p_f`")
->pipe(new CalculatedColumn(array(
"Yield"=>function($row){
return ($row["Pass"]*100)/$row["Total_Tested"];
}
)))
->pipe($this->dataStore('comb_p_f'));
}
};
when i try to execute I get an error --
[14-Dec-2022 15:31:56 UTC] PHP Fatal error: Uncaught Error: Class 'CalculatedColumn' not found in /Applications/MAMP/htdocs/acdnet/Test_Report_4/TestReport4.php:40 Stack trace: #0 /Applications/MAMP/htdocs/acdnet/vendor/koolreport/core/src/KoolReport.php(101): TestReport->setup() #1 /Applications/MAMP/htdocs/acdnet/Test_Report_4/index.php(6): koolreport\KoolReport->__construct() #2 {main} thrown in /Applications/MAMP/htdocs/acdnet/Test_Report_4/TestReport4.php on line 40
Anu help would be appreciated.