1 Reply Latest reply on Sep 14, 2006 7:15 PM by savyasachi

    Populating ComboBox from a DataService

    savyasachi
      I have a ComboBox on my page and trying to populate with the database values. I am seeing empty cells in the combobox and the dropdown control is showing as if I have the data, but nothing showing for labels. Looks like the database query is working OK on the java side, but the debug log on the flex side shows that the last element is repeating:

      Debug log on the JAVA side:

      SELECT BOUNDRY_C, BOUNDRY_X FROM ENG_OWN.ENG_BOUNDRY_DESCRIPTION Where BOUNDRY_TYPE_C = 'DIV' Order by BOUNDRY_X
      Boundary Name = <ALBANY> Code = <AY>
      Boundary Name = <APPALACHIAN> Code = <AP>
      Boundary Name = <ATLANTA> Code = <AT>
      Boundary Name = <BALTIMORE> Code = <BA>
      Boundary Name = <C&O> Code = <HU>
      Boundary Name = <FLORENCE> Code = <FL>
      Boundary Name = <JACKSONVILLE> Code = <JX>
      Boundary Name = <MIDWEST> Code = <MW>
      Boundary Name = <WESTERN> Code = <WE>

      Debug Log on the Flex side:
      [Flex] [DEBUG] Before manage sequence sequence info for: itis.boundary numSequences=0 numClients=0 numItems=0 numFills=0 numAssociations=0 numSMOSequences=0 numNestedClients=0 numNestedClientIds=0
      [Flex] [DEBUG] After manage sequence sequence info for: itis.boundary numSequences=1 numClients=1 numItems=1 numFills=1 numAssociations=0 numSMOSequences=0 numNestedClients=0 numNestedClientIds=0
      [Flex] [DEBUG] Committed transaction
      [Flex] [DEBUG] After invoke service: data-service
      reply: Flex Message (flex.data.messages.SequencedMessage)
      sequenceId = 0
      sequenceSize = 9
      (no sequence proxies)
      clientId = null
      correlationId = null
      destination = itis.boundary
      messageId = 65E07472-022E-0090-3754-27368204F137
      timestamp = 1158265933602
      timeToLive = 0
      body =
      [
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>,
      Boundary Name = <WESTERN> Code = <WE>
      ]

      [Flex] [DEBUG] Serializing AMF/RTMP response
      Version: 3
      (Command method=_result (0) trxId=3)
      (Typed Object #0 'flex.data.messages.SequencedMessage')
      sequenceId = 0
      destination = "itis.boundary"
      headers = (Object #1)
      dataMessage = null
      correlationId = "99213B31-6873-A3DA-A5E7-AE078B59CB21"
      messageId = "65E07472-022E-0090-3754-27368204F137"
      timestamp = 1.158265933602E12
      clientId = "BB664BB1-5C87-8A1B-383B-AE078B49C9B9"
      timeToLive = 0.0
      sequenceProxies = null
      sequenceSize = 9
      body = (Array #2)
      [0] = (Typed Object #3 'com.csx.itis.sync.Boundary')
      boundaryName = "WESTERN"
      boundaryCode = "WE"
      [1] = (Ref #3)
      [2] = (Ref #3)
      [3] = (Ref #3)
      [4] = (Ref #3)
      [5] = (Ref #3)
      [6] = (Ref #3)
      [7] = (Ref #3)
      [8] = (Ref #3)

      My MXML file contents:
      -------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <!--
      ////////////////////////////////////////////////////////////////////////////////
      //
      // Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
      // All Rights Reserved.
      // The following is Sample Code and is subject to all restrictions on such code
      // as contained in the End User License Agreement accompanying this product.
      // If you have received this file from a source other than Adobe,
      // then your use, modification, or distribution of it requires
      // the prior written permission of Adobe.
      //
      ////////////////////////////////////////////////////////////////////////////////
      -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="fill()" layout="absolute">

      <mx:Script>
      <![CDATA[
      import mx.data.DataService;
      import mx.collections.ArrayCollection;
      import mx.controls.Alert;
      import mx.rpc.events.FaultEvent;
      import com.csx.itis.sync.Device;
      import com.csx.itis.sync.Boundary;

      public var boundariesDS:DataService;
      public var devicesDS:DataService;

      [Bindable]
      public var divisions:ArrayCollection;
      [Bindable]
      public var roadmasters:ArrayCollection;
      [Bindable]
      public var devices:ArrayCollection;

      private function fill():void
      {
      divisions = new ArrayCollection();
      boundariesDS = new DataService("itis.boundary");
      boundariesDS.fill(divisions, "DIV");
      //Alert.show("Divisions ", "" + divisions.length);

      roadmasters = new ArrayCollection();
      boundariesDS.fill(roadmasters, "RES");
      //Alert.show("RM Codes ", " " + roadmasters.length);

      devices = new ArrayCollection();
      devicesDS = new DataService("itis.sync");
      devicesDS.fill(devices)
      //Alert.show(String(devices.length), 'Info')
      }

      private function faultHandler(event:FaultEvent):void
      {
      Alert.show(event.fault.faultString, 'Error')
      }
      ]]>
      </mx:Script>

      <mx:Panel x="10" y="10" width="780" height="120" layout="absolute" title="Filter Attributes">
      <mx:Label x="10" y="10" text="Division"/>
      <mx:ComboBox x="66" y="8" width="199" dataProvider="{divisions}" labelField="boundaryName"></mx:ComboBox>
      <mx:Label x="291" y="10" text="OR"/>
      <mx:ComboBox x="467" y="8" width="104" text="Roadmaster R&amp;L" dataProvider="{roadmasters}" labelField="boundaryCode"></mx:ComboBox>
      <mx:Label x="328" y="10" text="Roadmaster R&amp;L Code"/>
      <mx:CheckBox x="15" y="45" label="Mainline Devices"/>
      <mx:CheckBox x="138" y="45" label="Yard Devices"/>
      <mx:CheckBox x="240" y="45" label="All"/>
      <mx:VRule x="273" y="36" width="24" height="34"/>
      <mx:RadioButton x="295" y="45" label="Show WOWs"/>
      <mx:RadioButton x="396" y="45" label="Show BOBs"/>
      <mx:RadioButton x="490" y="45" label="Show Both"/>
      <mx:Button x="589" y="28" label="Submit"/>
      <mx:Button x="674" y="28" label="Reset"/>
      </mx:Panel>
      <mx:Panel x="10" y="138" width="780" height="452" layout="absolute" title="Device Sync Stats">
      <mx:DataGrid id="dg" dataProvider="{devices}" width="760" height="412" editable="false" x="0" y="0">
      <mx:columns>
      <mx:DataGridColumn dataField="deviceId" headerText="Device ID" editable="false"/>
      <mx:DataGridColumn dataField="deviceName" headerText="Device Name"/>
      <mx:DataGridColumn dataField="startTime" headerText="Start Time"/>
      <mx:DataGridColumn dataField="endTime" headerText="End Time"/>
      <mx:DataGridColumn dataField="duration" headerText="Duration"/>
      <mx:DataGridColumn dataField="status" headerText="Status"/>
      <mx:DataGridColumn dataField="channel" headerText="Channel"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Panel>

      </mx:Application>

      ----------------------------------------------------------------
      Please help.