1 Reply Latest reply on Oct 25, 2009 6:44 AM by Gregory Lafrance

    How acess data after retrieving it from a web service

    BastiaanWilderom

      I am a newbie

       

      I suceed in geting data from a web service am puting it in an arraycollection using the following code

       

      The data comes from a SQL table with 10 rows and 5 collumns.

       

      public mydata : ArrayColection;

       

      Private function datadandler(event:ResultEvent):void

       

      mydata=event.result.Tables.table.rows;

       

       

      My doubt now is how can I extract the data from each collumn and row of the ArrayCollection.

       

      I need to access one specific collumn and use the value from that collumn

       

       

      thanks in advance

        • 1. Re: How acess data after retrieving it from a web service
          Gregory Lafrance Level 6

          It depends on how the data is formed when it comes back and is put in the ArrayCollection.

           

          In general, you can access the 6th row of an ArrayCollection lilke this:

           

          myAC.getItemAt(5);

           

          You can loop through ab ArrayCollection like this:

           

          for each(var obj:Object in myAC){

            trace(obj);

          }

           

          But then the question becomes how are the fields in each row of data formed?

           

          If the rows of data are objects, you could access the data like this:

           

          myAC.getItemAt(5).custName or sometimes like this:myAC.getItemAt(5)[custName]

           

          So it depends how you data is coming back.

           

          If this post answers your question or helps, please mark it as such.

          1 person found this helpful