0 Replies Latest reply on Nov 24, 2009 7:59 AM by DLCKid

    HELP please with CFC data into Flex

    DLCKid

      Hi all,

       

      *EDIT*

       

      New question.  I have a dummy app set up that calls a CFC function via RemoteObject and returns my query.  My query is then bound to a DataGrid and everything imports nicely.  I simply just do  acData = ArrayCollection(event.result);  and the grid populates fine.  However, if I try to access individual elements of my ArrayCollection, for instance   acData[0].typename   , it returns a blank value and/or undefined.  Why can't I access individual pieces but it will attach to a datagrid no problem?

       

       

      *Original Issue*

       

      I currently have a flex app built calling a function from my CFC.  The CFC simply calls the database and returns the query into flex (returntype="query").  In flex, I have it plugging these records into a comboBox.  The comboBox has 4 objects in it, but not my data.  It knows how many records are in the query but I can't get my data.  If I try accessing the data it says it is undefined.  What am I missing?  I swear I had this working last week and now it doesn't.  Driving me nuts and I'm about to lose my mind.

       

      CFC function:

      <cffunction name="getExceptionTypes" access="remote" returntype="query">
             
              <cfquery name="getTypes" datasource="#xGIS#" username="#xIDGIS#" password="#xPWGIS#">
                  SELECT typename, xid
                  FROM #xToGIS#.ProfileExceptionTypes
                  WHERE DisplayInDropDown = 'Y'
              </cfquery>
             
              <cfdocument filename="exceptionTypes.pdf" format="pdf" overwrite="yes">
                  <cfdump var="#getTypes#">
              </cfdocument>
                     
              <cfreturn getTypes>
             
          </cffunction>

       

      Flex code (relavent pieces only):

       

      [Bindable] private var exceptionList:ArrayCollection = new ArrayCollection();


      private function fillExceptionTypes(event:ResultEvent):void
      {
          var tempList:ArrayCollection = ArrayCollection(event.result);
         
          for (var i:int = 0; i < tempList.length; i++)
          {
              exceptionList.addItem({ID: tempList[i].xid, Name: tempList[i].typename});
          }
      }

       

       

      My comboBox is set up with the dataprovider as exceptionList and the labelName is "Name".  This worked before but I'm not sure what happened or why it won't work now!

       

      Thanks.