Last active
July 1, 2020 15:50
-
-
Save collinticer/e4b29069f3e366ad6e1f3348f2b55f5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
CSVResultsExport(); | |
</cfscript> | |
<cffunction name="CSVResultsExport"> | |
<cfscript> | |
var pc = getpagecontext(); | |
pc.getresponse().setcontenttype( 'text/csv' ); | |
//make sure browsers like IE don't try and open "embedded excel" | |
cfheader( name="Content-Disposition", value="attachment;filename=voting-results.csv" ); | |
</cfscript> | |
<!--- all the following happen in-line to prevent extra line breaks at the beginning of the content ---> | |
<cfcontent reset="true"><cfset WriteOutput( QueryToCSV( GetExportQuery(), 'question_id,question_content,yea_votes,yea_percent,nay_votes,nay_percent,abstain_votes,abstain_percent,question_voter_size,full_voter_size' ) )><cfabort> | |
</cffunction> | |
<cffunction name="GetExportQuery"> | |
//return a CF query | |
</cffunction> | |
<cffunction name="QueryToCSV"> | |
//i won't define this, but i use Ben Nadels QueryToCSV | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment