1 Reply Latest reply on Dec 30, 2009 9:24 AM by Gregory Lafrance

    (HTTPService -> result="" - to ArrayCollection) -  a question for super expert ;)

    Ryma5ek


      Firstly look at my example then you will read the question:


      Look at example below - I'm using HTTPService component to retrieve data from SQL database
      (read_record.php is generating nice and tidy xml file with my data)

       


      <!-- (A) read  -->
      <!-- =================== HTTP SERVICE (read_record) ============================ -->
          <mx:HTTPService id="readTimed"
              url="http://www.pudelek.pl/SCRIPT/A/read_record.php"
              result="patient(event)">
          </mx:HTTPService>

       


      Then 'result' is calling a function patient() which task is to assign 'event.result'
      to ArrayCollection called 'A_patient_dp'  (this ArrayCollection is a data provider
      for a specific data grid)

       


      private function patient(event:ResultEvent):void {

       

          trace("A - PATIENT - loaded...")
          trace(event.result.patient.patient)

       

          A_patient_dp = event.result.patient.patient
      }

       

      Everything looks great here, data grid shows all the data from xml file generated
      by read_record.php

       

      and now is my problem :

       

      I don't want to display all the data, I want HTTPService to retrieve only particular data
      which are described by variable {parametr} - this var is generated by my application

       

      I've dond it this way:

       

      <!-- (A) MAP POSITIONING -->
      <!-- =================== HTTP SERVICE (read_record) ============================ -->
          <mx:HTTPService id="readRequestA"
              url="http://www.pudelek.pl/SCRIPT/A/A_send_read_record.php"
                  useProxy="false"
                  method="POST">
              <mx:request xmlns="">
                  <idstaff>{parametr}</idstaff>
              </mx:request>
          </mx:HTTPService>

       

      I'm looking into source of 'A_send_read_record.php' in the internet browser and I see
      exact data tree (filtered) which I need.
      The problem here is : how to call function patient(event:ResultEvent) and give it
      data from the event to be assigned to ArrayCollection - like in first example.

       

      Thanks for all the ideas !!