Downloading report from customer portal

Hi All,

I have embedded a report on the customer portal using the "Grid" widget. I want to include a link on the web-page displaying the report to enable download of the report in csv format. Does anyone here have any suggestions on how this can be done? Is there a widget to enable download of report from the customer portal. Any pointers in this direction will be highly appreciated. Please see the attached screenshot of the report being displayed on the customer portal.

Thanks,

John

Comments

There's no standard widget that does this, but I've built custom widgets for clients that do so. You can create a custom PHP endpoint that runs the report via Connect for PHP and echoes the data in CSV format. The only tricky part is getting the HTTP headers right so it downloads the file correctly across browsers, this should get you started:


header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/octet-stream");
header(sprintf("Content-disposition: attachment; filename=\"%s.csv\";",$filename));
header("Content-Transfer-Encoding: binary");

Zircon - This is a contributing Drupal Theme
Design by WeebPal.