Hi,
I am building a Report using ArrayDataSource. However, I could not get the raw data. Below is my code.
class MyReport extends \koolreport\KoolReport
{
public function settings()
{
if(array_key_exists('dataset',$this->params)){
return array(
"dataSources"=>array(
"array_example_datasource"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"associate",
"data"=>$this->params['dataset']
),
)
);
}
else{
return array(
"dataSources"=>array(
"array_example_datasource"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"associate",
"data"=>array()
),
)
);
}
}
protected function setup(){
$this->src('array_example_datasource')
->pipe($this->dataStore("datax"));
}
}
$data = array(
array("country"=>"US","amount"=>50000),
array("country"=>"Canada","amount"=>31000),
array("country"=>"Mexico","amount"=>42000),
);
$myReport = new MyReport(array("dataset"=>$data));
print_r( $myReport->dataStore('datax')->data()); //empty Array() is shown