KoolReport's Forum

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

What to use to create such a table? #2812

Open Richb201 opened this topic on on Aug 30 - 2 comments

Richb201 commented on Aug 30

I am trying to create a table such as this.

Each BC is in a single record in my table. Is there any example of how to create groups of data like this?

Sebastian Morales commented on Sep 14

This is a case use tranposing each data row from vertical columns to horizontal rows. You could use the Map process for it like this:

->pipe(new \koolreport\processes\Map(array(
    "{value}" => function($row) {
        $newRows = [];
        foreach ($row as $columnName => $value) {
            $horizontalRow = [
                "field" => $columnName,
                "value" => $value,
            ];
            array_push($newRows, $horizontalRow);
        }
        return $newRows;
    }
)))
->pipe($this->dataStore("result"));

After the process your datastore "result" will be a table with 2 columns "field" and "value" with similar format to your screenshot. Rgds,

Richb201 commented on Sep 15

thx

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
solved

None