2 Replies Latest reply on Apr 13, 2009 9:34 PM by Gregory Lafrance

    DataGrid XML error

    imandir

      I'm trying to make a contact list in a DataGrid and I get my XML file from GoldMine.

      Here is a sample of the XML

      <gmdata>
        <accounts>
          <account gm_recid="JDFUHEF$1&amp;REDFV" gm_accountno="A652451337%U&lt;&#123;6UBbg" >
            <properties>
              <property name="Address1" db_name="ADDRESS1" >
                <property_string>555 State St.</property_string>
              </property>
              <property name="Address2" db_name="ADDRESS2" >
                <property_string>Room B</property_string>
              </property>
              <property name="ASSN" db_name="COMPANY" >
                <property_string>Company</property_string>
              </property>
              <property name="City" db_name="CITY" >
                <property_string>Cincinnati</property_string>
              </property>
              <property name="State" db_name="STATE" >
                <property_string>OH</property_string>
              </property>
              <property name="Zip" db_name="ZIP" >
                <property_string>55555</property_string>
              </property>
            </properties>
          </account>
        </accounts>
      </gmdata>
      

      Here is my mxml:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
           layout="absolute"
           initialize="assocService.send()">
           
           <mx:Script>
                <![CDATA[
                     import mx.collections.ArrayCollection;
                     import mx.rpc.events.ResultEvent;
                     
                     [Bindable]
                     private var assocData:ArrayCollection;
                     
                     private function resultHandler(event:ResultEvent):void {
                          assocData = event.result.gmdata.accounts.account.properties;
                     }
                     
                ]]>
           </mx:Script>
           
           <mx:HTTPService id="assocService"
                url="data/associations.xml"
                result="resultHandler(event)" />
                
           <mx:DataGrid dataProvider="{assocData}" />
           
      </mx:Application>
      

      It compiles fine, and I get this error when the browser tried to load the page.

      Error: Unknown Property: 'properties'.
          at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[C:\autobuild\3.2.0\frame works\projects\framework\src\mx\collections\ListCollectionView.as:694]
          at test/resultHandler()[C:\FlexProjects\test\src\test.mxml:15]
          at test/__assocService_result()[C:\FlexProjects\test\src\test.mxml:23]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\framewor ks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:290]
          at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
          at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responde r.as:43]
          at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:74]
          at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:403]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at flash.net::URLLoader/onComplete()

      I'm trying to figure out how to get the data out correctly.

      I'd like the information displayed something like this:

      Address1
      Address2ASSNCityStateZip
      555 State St.Room BCompanyCincinnatiOH55555

       

      I'm not sure how my assocData variable in the resultHandler function should be set.

      private function resultHandler(event:ResultEvent):void {
           assocData = event.result.gmdata.accounts.account.properties;
      }
      

      I tried this as well, with the same error:

      private function resultHandler(event:ResultEvent):void {
           assocData = event.result.gmdata.accounts.account.properties.property;
      }
      

      Is there a way to handle the name attribute in the property tag then grab the info from the property_string tag?