2 Replies Latest reply on Jul 26, 2006 1:35 AM by |mantra|

    returning query from cfc

    |mantra| Level 1
      is it possible to return query data from a cfc back to flex using the following :

      <cffunction name="getClientJobsQuery" access="remote" returntype="query">
      <cfset myQuery="">
      <cfquery name="myQuery" datasource="flexTrainingData">
      SELECT projectID, projectName, description, contributor
      FROM projects
      <cfreturn myQuery>

      i can't seem to get the data to display into a datagrid. I've tested the query on a normal page and it does work, and just to be sure the component is actually being reached i added another method that passes a simple string back - and does so successfully so no drama there. This is how i pass recordSets back to flash, is it the same for flex based remoting ?

      my code on the flex end is:

      <mx:Button label="get Query Remote Object" click="myService.getClientJobsQuery()"/>
      <mx:DataGrid dataProvider="{qResult}">
      <mx:DataGridColumn dataField="project number"/>
      <mx:DataGridColumn dataField="project name"/>
      <mx:DataGridColumn dataField="description"/>
      <mx:DataGridColumn dataField="contributor"/>

      Any help greatly appreciated, i'm keen to get into flex :)