+ Start a Discussion

SOQL Aggregate Functions to CSV



I'm aware that from Sprint '10, new aggregate functions (SUM, MAX) will be available for SOQL queries.


That's great. now does anyone know how I would be able to export this data to a CSV / excel?


Basically, I need to generate different CSV / Excel documents based on queries that use aggregate functions.


The Salesforce Report Tool is useless, since if groupding is done, it cannot be generated to PDF, and even if generated to Excel, detail information isn't shown on the totalled row.


Any ideas?






Hi Ben,


I'm curious if you were able to solve this - I have the same requirement on a project I'm working on.  I have found a couple of solutions in the community but wondered if you went about it the same way or if you found another way to manage it.






I've yet to solve this.

I would be interested to find how you have.




I"ve gotten as far as the solution suggested in this post:  http://community.salesforce.com/t5/Apex-Code-Development/How-to-export-data-to-CSV-file-using-Apex/m-p/167910#M25511


I'm working on the controller to get the object/fields that I want and then just need to figure out how to save the file instead of opening it up.  Will keep you updated.