KoolReport's Forum

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

How to CSV export in Dashboard #2773

Open GHSix opened this topic on on Jul 28, 2022 - 7 comments

GHSix commented on Jul 28, 2022

Lokking at [https://www.koolreport.com/docs/dashboard/export/](export docs)...

Overview #
Exporting feature is one of the must-have feature in any reporting system.

XLS/CSV Engines #
To be provided in next version of Dashboard

There is a roadmap to when will this be released?

There is no way to export to, at least, CSV right now?

I'm scared now, if it can't do CSV/XLS in the months ahead, it will invalidate the use of Dashboard in my project.

KoolReport commented on Jul 29, 2022

We are in the beta testing for the Excel and CSV so we did not list the features in our documentation.

The Dashboard can export CSV and Excel, we have example here.

Please include this CSVEngine inside app export() function:

Here is the line of code App.php::164

Let us know if you need further assistance.

GHSix commented on Jul 29, 2022
Message: Class 'CSVEngine' not found
Line: 36
File: /www/dev/koolreport/dashboard/App.php
 Collapse
#0: /www/dev/koolreport/vendor/koolreport/dashboard/Application.php Line 310 : export([])
#1: /www/dev/koolreport/vendor/koolreport/dashboard/TExportable.php Line 136 : getExportHandler([])
#2: /www/dev/koolreport/vendor/koolreport/dashboard/TAction.php Line 37 : actionExport([{},{}])
#3: /www/dev/koolreport/vendor/koolreport/dashboard/Widget.php Line 139 : action(["Export",{},{}])
#4: /www/dev/koolreport/vendor/koolreport/dashboard/Dashboard.php Line 259 : handle([{}])
#5: /www/dev/koolreport/vendor/koolreport/dashboard/pages/Main.php Line 137 : handle([{}])
#6: /www/dev/koolreport/vendor/koolreport/dashboard/Application.php Line 217 : handle([{}])
#7: /www/dev/koolreport/vendor/koolreport/dashboard/Application.php Line 149 : handle([{}])
#8: /www/dev/koolreport/dashboard/index.php Line 35 : run([])

composer.json:

"require":{
        "koolreport/pro":"*",
        "koolreport/blade":"*",
        "koolreport/export":"*",
        "koolreport/dashboard":"*"
}

Do I need some specific version?

KoolReport commented on Jul 29, 2022

You need to add this line on top of App.php:

use koolreport\dashboard\export\CSVEngine;

App.php:line 14

GHSix commented on Jul 29, 2022

My bad, it works now!

But now, I have 1 more question with this export:

The query has a column that is not been displayed on screen. How to instruct CSVEngine to add this column to the CSV result?

This column is just not in the fileds list, maybe adding it to the list with a hidden option to hide it on screen but allow in CSV, if exists such option?

KoolReport commented on Aug 2, 2022

The exported data is what you see (on screen) is what you get (in csv). I will note your topic as suggestion for dev.team to further development.

GHSix commented on Aug 2, 2022

Just my $2c.

I guess that, if possible, to be able to dinamicaly hide/show columns on Table and have export honoring it, may be more flexible.

Something like hide/show and hideAll/showAll columns could be used the same way that removing pagination on export is used.

Now I noticed that when I dinamically change the content of onscreen data, it will be honored at PDFExport but not in CSVExport, but I like this default, it makes sence.

ie.

Data:

["name" => "John Doe", "email" => "john.doe@gmail.com", "password" => "nobody@home"];

Screen:

Name | Email
John Doe | john.doe@g...

PDF:

Name | Email
John Doe | john.doe@g...

CSV:

"name", "email"
"John Doe", "john.doe@gmail.com"

That is what is happening now.

So, please, donĀ“t change this CSV behavior of using the data content and not the screen content. It totally makes sence.

And, be able to add password field to PDF and CSV Export would be awesome.

Thank you.

KoolReport commented on Aug 3, 2022

I will pass your suggestion to dev.team.

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
suggestion

Dashboard