3 Replies Latest reply on Apr 24, 2007 10:21 AM by JoeADSK

    How is a query stored in an arrayCollection??

    JoeADSK
      I am trying to implement a slider for an x-axis of dates,
      I have a query that gets a number with a date and a remote object that stores this result into an Array collection called qResult

      select dateThing as week_day , count(*) as cnt from table


      so.....
      How does this array collection look?
      I am trying to access it in my event handler like ----- monthData = event.result.week_day.source as Array;
      but that isnt working, i tried some variations and it didnt work either .

      Here is some more code:
      [Bindable]
      public var qResult:ArrayCollection;
      [Bindable]
      public var monthData:Array;


      <mx:RemoteObject
      id="myService"
      destination="ColdFusion"
      source="CFCfile"
      showBusyCursor="true"
      >
      <mx:method name="ITOpen" result="handleQueryResult(event)" fault="Alert.show(event.fault.message)"/>
      </mx:RemoteObject>

      public function handleQueryResult(event:ResultEvent):void{
      qResult=event.result as ArrayCollection;
      monthData = event.result.week_day.source as Array;
      }

      it says week day is an unknown property, so i guess i dont understand how it is stored in the arrayCollection.
      I was told to use GetItemAt but It wasnt very clear.

      Thanks!


        • 1. Re: How is a query stored in an arrayCollection??
          BLXWebMaster Level 1
          Are you trying to get an array of all records or just one? If you are trying to get just one, try this.

          public var qResult:ArrayCollection = null;
          public function handleQueryResult(event:ResultEvent):void{
          qResult = new ArrayCollection();
          qResult.source = event.result as Array;
          monthData = myService.ITOpen.lastResult[0].week_day;
          }
          • 2. Re: How is a query stored in an arrayCollection??
            Archades
            One thing you might want to try to do is to set the format to xml...I find its much easier to use xml than array collections. I dont have my code in front of me but I think you just need to set format="e4x" in the RemoteObject and the event.result will be an XMLList.
            Just a thought. Hope it helps
            • 3. Re: How is a query stored in an arrayCollection??
              JoeADSK Level 1
              quote:

              Originally posted by: BLXWebMaster
              Are you trying to get an array of all records or just one? If you are trying to get just one, try this.

              public var qResult:ArrayCollection = null;
              public function handleQueryResult(event:ResultEvent):void{
              qResult = new ArrayCollection();
              qResult.source = event.result as Array;
              monthData = myService.ITOpen.lastResult[0].week_day;
              }



              I think that Worked ! ! ! If i have problems ill replay.. Thanks! ! ! !