4 Replies Latest reply on Feb 24, 2011 11:58 PM by Flex harUI

    Populating a Drop Down List

    MikePotratz

      I'm new to using Flex/Flash Builder 4, so we'll get that out of the way immediately!

       

      My project uses a local database to retrieve and store information.  I've successfully created the database & can query it.  The problem I have is taking the results of that query and populating a simple dropdown list control.  All of the examples and tutorials I've seen, watched and read use either 1) local XML files for sample data or 2) a web data service to return items.  I've gone through those tutorials and trying to accomplish what I want is a piece of cake.  The "Data/Services" has no such 'connector' for local databases, so those 'techniques' don't apply...

       

      I've tried numerous different solutions I've found and the result is I get all sorts of errors.  This is just my latest attempt and while it doesn't throw any errors, the drop down list just shows [object Object] for each item returned by the query.  It does have the correct number of [object Object]'s in the list so I know it's getting all the database info in the query...

       

       

      private var getFacNum:SQLStatement = new SQLStatement();

       

      [Bindable]

      private var ddFacNum:ArrayCollection = new ArrayCollection();

       

       

      private function populateFacilityNumber():void

      {

       

      getFacNum.sqlConnection = connection;

      getFacNum.text = "SELECT id_facility, facilityNumber FROM facility ORDER BY facilityNumber";

      getFacNum.execute();

      connectionStatus.text = "Executed Query";

      ddFacNum = new ArrayCollection(getFacNum.getResult().data);

      }

       

       


       

      <s:DropDownList includeIn="NewInspection"

      dataProvider="{ddFacNum}"

      fontFamily="Arial" fontSize="16"

      id="ddFacilityNumber"

      prompt="Select facility number...">

      </s:DropDownList>

       

       

      I'm coming from a .NET developing environment and it seems that these two types of systems are vastly different.  Any and all assistance, links, pointers, whatever, would be greatly appreciated.