Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
After PivotExtract, use the Map
process to change the columns and rows like this:
->pipe(new PivotExtract(...))
->pipe(new Map(array(
"{value}" => function($row) {
foreach ($row as $colName => $value} {
$newColName = str_replace("{{all}}", "Total", $colname);
$row[$newColName] = $value;
unset($row[$colname]);
}
$row["customerName"] = str_replace("{{all}}", "Total", $row["customerName"]);
return $row;
}
)))
Thank you for your support. I have modified a bit as below.
->pipe(new PivotExtract(...))
->pipe(new Map(array(
"{value}" => function($row) {
foreach ($row as $colname => $value} {
$newColName = str_replace("{{all}}", "Total", $colname);
$row[$newColName] = $value;
if($colname != $newColName){ //if new column name is different from old one, then unset
unset($row[$colname]);
}
}
$row["customerName"] = str_replace("{{all}}", "Total", $row["customerName"]);
return $row;
}
)))
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo