KoolReport's Forum

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

Export: how to use some report data in the export file name #1012

Closed Eugene opened this topic on on Jul 25, 2019 - 3 comments

Eugene commented on Jul 25, 2019

Hi,

I would like to add a date, for example, to the exported file name. How to do it?

So i have something like this

$report = new report_class;
$report->run()->exportToCSV(array(
        "dataStores" => array(
            "report_datastore" => array(
                "delimiter" => ",",
                "columns"=>array(
                    'name', 'quantity'
                )
            )
        )
))->toBrowser("file name.csv");

and want to add the date that i can get form my data store like this $Date = $this->dataStore("report_datastore")->data()[0]['date'];but how to use it in this case? Is it possible?

KoolReport commented on Jul 25, 2019

You do this:

$report = new report_class;
$report->run();
$date = $report->dataStore("report_datastore")->get(0,"date");
$report->exportToCSV(array(
        "dataStores" => array(
            "report_datastore" => array(
                "delimiter" => ",",
                "columns"=>array(
                    'name', 'quantity'
                )
            )
        )
))->toBrowser("file name-".$date.".csv");
Eugene commented on Jul 25, 2019

Great!!!

Thank you. I enjoy Koolreport every time I use it and special thanks for the support!

KoolReport commented on Jul 25, 2019

You are welcome :) thank you for being our customer!

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