KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to have fixed number rows/columns if some of them have not data #2490

Open Imran Arshad opened this topic on on Dec 14, 2021 - 1 comments

Imran Arshad commented on Dec 14, 2021

I'm trying to build a report. Since data is dynamic, some sub-rows or columns are missing. I want to show those rows/columns if data is missing. I have attached a screenshot. Please look at sub-rows of Hispanic or Latino and Not Hispanic or Latino. I'm sure there must be a way, but I'm unable to figure it out and really need to get it done asap. Would appreciate quick response.

Thank you

Sebastian Morales commented on Dec 14, 2021

Ok, one method is to append data rows with labels but empty data to your datasource and before the Pivot process. For example, you could use the AppendRow process like this:

$this->src("myDataSource")
...
->pipe(new \koolreport\processes\AppendRow(array(
    array( "type" => "Hispanic or Latino", "subtype" => "Central American", "vaccine" => "Astra Zeneca", "doses" => 0), // we add empty/null/zero measure data so that data aggregate is not affected
    array( "type" => "East Asian", "subtype" => "Vietnam", "vaccine" => "Pfizer", "doses" => 0), 
    ...
)))
->pipe(new \koolreport\processes\Pivot(...))
...

Let us know if we understand your problem correctly. Tks,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Pivot