It is very easy since all parameters you set to report will be available in settings()
and setup()
. For example, you build a DynamicReport which will receive 2 parameters, first is the csvFile
and second is the year
for Filter. You will initiate report like this:
$report = new DynamicReport([
"csvFile"=>"../data/sale.csv",
"year"=>2018
]);
$report->run()->render();
Your DynamicReport.php
will be something like this:
class DynamicReport extends \koolreport\KoolReport
{
function settings()
{
return [
"dataSources"=>[
"csvData"=>[
"class"=>'\koolreport\datasources\CSVDataSource',
'filePath'=>$this->params["csvFile"]
]
]
];
}
function setup()
{
$this->src("csvData")->pipe(new \koolreport\processes\Filter([
"year"=>$this->params["year"]
]))
->pipe($this->dataStore("result"));
}
}
Hope that helps.