0 Replies Latest reply on Nov 17, 2009 12:22 PM by cannedRadio

    query out of a cfc

    cannedRadio

      I have a cfc with a simple query.

       

      <cfcomponent>

      <cffunction name="myFunction" access="remote" returntype="query">

      <cfargument name="myArgument" type="string" required="no">

              <cfquery datasource="myDataSource" name="qGetStuff">

              SELECT lastName

                  FROM tblUsers

              </cfquery>

      <cfreturn qGetStuff>

      </cffunction>

      </cfcomponent>

       

      I'm trying to do... well anything with the data.  I can see in flexbuilder that I'm getting the wddxPackage and all the data.

       

      the package is formated:

      <wddxPacket version='1.0'>

      <header/>

      <data>

        <recordset rowCount='605' fieldNames='LASTNAME' type='coldfusion.sql.QueryTable'>

          <field name='LASTNAME'>

            <string>Jones</string>

          </field>

        </recordset>

      </data>

      </wddxPacket>

       

      I'm using:

      public var theData:XMLList;

      public function onResult(e:ResultEvent):void{

      theData = e.result.wddxPacket.data.recordset.field[0];

       

      }

      to access the data.  I don't get any exceptions, however the datagrid doesn't populate

      <mx:HTTPService resultFormat="e4x" id="liveData" url="http://mydomain.com/test.cfc?method=myFunction" result="onResult(event);" />

      <mx:DataGrid id="mygrid" dataProvider="{theData}"/>

       

      am I doing this all wrong?

       

      what is the best way to get complicated data types out of CF into flex?

       

      TIA