KoolReport's Forum

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

PivotSQL and Excel Export #2687

Open Bastian Schneider opened this topic on on May 19, 2022 - 2 comments

Bastian Schneider commented on May 19, 2022

Hi there,

has anybody managed to get an Excel Export from PIvotSQL Matrix? I basically followed this Sample: https://www.koolreport.com/examples/reports/excel/pivotmatrix/ But when I export to Excel it will always default to the initial report, even if I change rows, columns and aggregates. On the example the download reflects the current state of the report.

Any idea, what I´m doing wrong?

KoolReport is running inside of Laravel.

Thanks a lot for any hint! Bastian

This is my report.php file:

$this->src('database')
            ->query("select * from sales where SalesDate >='" . $this->params['daterange'][0] . "'
            and SalesDate <='" . $this->params['daterange'][1] . "'")
            ->pipe(new \koolreport\pivot\processes\PivotSQL([
                "column" => "Status",
                "row" => "Client",
                "aggregates" => array(
                    "count" => "*",
                    "sum" => "OrderValue"
                    
                    
                ),
            ]))
            ->pipe(new ColumnMeta(array(
                "OrderValue - sum" => array(
                    'type' => 'number',
                    "prefix" => "€",
                ),
            )))
            ->pipe($this->dataStore('pivotData'));
Sebastian Morales commented on May 21, 2022

Pls try to put the following input inside your form tag (method post), together with the PivotMatrix widget:

<form method="post">
    ...
    <input type="hidden" name="koolPivotUpdate" value="1" />
    {exportButton}
    {PivotMatrix}
</form>

Let us know how it works for you. Tks,

Bastian Schneider commented on May 23, 2022

That solved it, thanks a lot! Cheers Bastian

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
solved

None