1 Reply Latest reply on Dec 1, 2011 9:54 AM by Flex harUI

    Accessing The LastResult individaul items

    richievcFlex

      Hi friends

       

      New to the Flex World and I first have to say Im liking the product.

       

      Im a native PHP developer so this is a brand new world for me so of the simplest task pose to be long standing problems.

      Well here is one of those problems.

       

      All I want to do is access each item of a lastResult property I have a form but the result in the lastReslt can be the answer from a selection and rebuild the form I need access to each item so I can test those items and populate the form accordingly

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark"

                         xmlns:mx="library://ns.adobe.com/flex/mx"

                         xmlns:auditdata="services.auditdata.*"

                         width="95%" height="85%"

                         creationComplete="initChecklist()">

         

          <fx:Script>

              <![CDATA[

                  import mx.controls.Alert;

                 

                  public var audit_id:int; // is passed in from main application Working

                 

                  [Bindable]

                  public var AuditStart:String = "";

                  [Bindable]

                  public var AuditEnd:String = "";

                 

                 

                  protected function get_audit_data_by_id(audit_id:Object):void

                  {

                      get_audit_data_by_idResult.token = auditData.get_audit_data_by_id(audit_id);

                  }

                 

                 

                  public function initChecklist():void

                  {

                      get_audit_data_by_id(audit_id); // gets the data from a service call also working  can bind to a list controler fine

       

                          // here is where I want to set up each variable to it bindable counterpart define above

                              AuditStart = get_audit_data_by_idResult.lastResult.list[0]; // the place where the Item lives OR

                               AuditStart = get_audit_data_by_idResult.lastResult.list[' AuditStart']; // the place where the Item lives

                  }

                 

              ]]>

          </fx:Script>

         

         

          <fx:Declarations>

              <s:CallResponder id="get_audit_data_by_idResult" />

              <auditdata:AuditData id="auditData"

                                   fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"

                                   showBusyCursor="true"/>

             

          </fx:Declarations>

         

      <!-- LAYOUTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->   

      <s:Label x="10" y="10" color="#619FEB" fontSize="18" fontWeight="bold" text="Checklist"/>

       

      <s:HGroup x="10" y="35" width="461" gap="10" verticalAlign="middle">

          <s:Label x="111" y="15" text="Audit Dates"/>

          <s:Label text="Start Date"/>

          <mx:DateField id="AuditStartInput" text="{AuditStart}" x="282" y="4" width="107"/>

          <s:Label x="385" y="15" text="End Date"/>

          <mx:DateField id="AuditEndInput" text="{AuditEnd}" x="445" y="4" width="113"/>

      </s:HGroup>   

         

         

         

      </s:BorderContainer>