Hello, I'm trying to process and visualize my data in an exportable report. This is the my data processing (in the setup() function):
$dsSetting = array(
'filePath' => dirname(__FILE__)."/csv/".$this->params["csv"],
'fieldSeparator' => ','
);
$src = new \koolreport\datasources\CSVDataSource($dsSetting, $this);
$src->pipe(new Custom(function($row) {
$row["ts_from"] = str_replace(" UTC+00:00","", $row["ts_from"]);
return $row;
}))
->pipe(new DateTimeFormat(array(
"ts_from" => array(
"from" => "d-m-Y H:i:s",
"to" => "d-M"
)
)))
->pipe(new Filter(array(
array("sensor", "=", "geiger"),
array("avg", "!=", null),
array("min", "!=", null),
array("max", "!=", null)
)))
->pipe(new Custom(function($row) {
$row["ts_from"] = array("v" => (int)$this->geiger_idx, "f" => $row["ts_from"]);
$this->geiger_idx ++ ;
return $row;
}))
->pipe(new OnlyColumn(
array("ts_from", "avg", "min", "max", "qi")
))
->pipe(new AggregatedColumn(array(
"min_measure" => array("min", "min"),
"max_measure" => array("max", "max"),
"avg_measure" => array("avg", "avg"),
"qi" => array("avg", "qi")
)))
->pipe($this->dataStore("csv_data_geiger"));
(printing rows in my Custom function works, so I'm sure data is correctly extracted from the csv file).
However, when I try to print my dataStore as follows (in my view file):
echo $this->dataStore('csv_data_geiger')->toJson();
it gives me the following result:
{"meta":{"columns":[]},"data":[]}
It turns out my dataStore is empty. What is the reason of that? Thank you!