5 Replies Latest reply on Nov 29, 2006 8:59 AM by Like2Flex

    Query to Excel problem

    Like2Flex Level 1
      Hi,

      I create a cfm to export data from my query, qOrds (which comes from my cfc).

      I actually have a button in flex which, when I click, needs to export data from my query to Excel.
      My flex button calls the following function :

      My function in Flex

      public function RetrieveExcel():void
      {
      var urll:URLRequest = new URLRequest(" http://bang:8500/dcsnew/Export2xls.cfm");

      navigateToURL(url,"_blank");

      }




      TextHERE is my Exportt2xls.cfm

      <cfinvoke component="mycfc.cfc" method="getOrds" returnvariable="qOrds">
      <cfinvokeargument name="mydate" value="#url.mydate#">
      </cfinvoke>

      <CFCONTENT TYPE="application/vnd.ms-excel">
      <cfheader name="Content-Disposition" value="filename=report.xls">

      <cfquery name="exportdata" dbtype="query">
      SELECT *
      FROM qOrds
      </cfquery>

      <table>

      <cfoutput>
      <tr>
      <cfloop list="#exportdata.columnlist#" index="TDFIELD">
      <td>#TDFIELD#</td>
      </cfloop>
      </tr>
      </cfoutput>

      <cfoutput query="exportdata">
      <tr>
      <cfloop list="#exportdata.columnlist#" index="COLUMNNAME">
      <td>#exportdata[COLUMNNAME][exportdata.currentrow]#</td>
      </cfloop>
      </tr>
      </cfoutput>

      <cfreturn #exportdata#>




      I have a date argument that I want to pass to the cfm.
      But when am running the function, it is giving me the following error :

      "Element mydate is undefined in URL."

      Where do I need to pass the variable "mydate" in my flex code.

      Any help would be highly appreciated.