Advertisement
snarfblat

Coldbox CFSpreadsheet Export

Aug 24th, 2011
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <cffunction name="export_do" returntype="void" output="false">
  2.         <cfargument name="event" required="true">
  3.  
  4.         <cfheader name="Content-disposition" value="attachment;filename=leads_export.csv" />
  5.  
  6.         <cfscript>
  7.         var rc = event.getCollection();
  8.         var modelObj = getModel('config');
  9.         var temp = StructNew();
  10.  
  11.         param name="rc.dealerid" default="0";
  12.         param name="rc.leadstatusid" default="0";
  13.         param name="rc.fromDate" default="#DateFormat('1/1/#Year(Now())#', 'mm/dd/yyyy')#";
  14.         param name="rc.toDate" default="#DateFormat(Now(), 'mm/dd/yyyy')#";
  15.  
  16.         temp = modelObj.leadExport(dealerid=rc.dealerid, leadstatusid=rc.leadstatusid, fromdate=rc.fromdate, todate=rc.todate);
  17.         </cfscript>
  18.  
  19.         <cfspreadsheet action="write" filename="#expandPath('.')#/export/leads_export.csv" overwrite="true" query="temp.export" sheetname="sheet1" />
  20.  
  21.         <cfscript>
  22.         setNextEvent('config.export');
  23.         </cfscript>
  24.  
  25.     </cffunction>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement