After SuperCube I get zero value in the max (class_id, professions_id) and sum (class_id) columns. instead of zero I need blank. I can't do it in the view code using formatValue function because I am using ComplexHeader = true.
function setup()
{
$this->src('db')
->query('CALL getSplitRewardReportFrom(:year)')
->params(array(
":year"=>$this->params["year"],
))
->pipe(new SuperCube(array(
"rows" => "teacher_id, id_number",
"columns" => "hour_num",
"max" => 'profession_id, class_id',
"sum" => "total_hours"
)))
->pipe(new \koolreport\processes\Map(array(
"{value}" => function($row) {
foreach ($row as $colName => $colValue) {
if (substr( $colName, 0, 11 ) === "hour_num - ") {
$newColName = substr($colName, 11);
$row[$newColName] = $row[$colName];
unset($row[$colName]);
}
}
return $row;
},
"{meta}" => function($meta) {
$colMetas = $meta["columns"];
foreach ($colMetas as $colName => $colMetaValue) {
if (substr( $colName, 0, 11 ) === "hour_num - ") {
$newColName = substr($colName, 11);
$colMetas[$newColName] = $colMetas[$colName];
unset($colMetas[$colName]);
}
}
$meta["columns"] = $colMetas;
return $meta;
}
)))
->pipe(new \koolreport\processes\RemoveColumn(array(
'{{all}} | profession_id - max', '{{all}} | class_id - max', '{{all}} | total_hours - sum'
)))
->pipe($this->dataStore("st"));
}