0 Replies Latest reply on Oct 11, 2011 2:59 PM by apage3

    Add a for each script to loop through HTTPService?


      I'm using Flash Builder 4 with the Flex 4.1 SDK.  I want to add a "for each" script to loop through my HTTPService XML file so only each nepName displays only once in my dropdown list.  In my XML file I have multiple records associated with nepName.  I would like ALL the records associated with each nepName to populate in my datagrid when it is selected from the dropdown.  Currently in my dropdown there is a nepName entry for each XML tag.  I hope I was able to explain that well enough. I'll try to put my code below so you can see everything I'm working with.




      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
              <s:VerticalLayout horizontalAlign="center" paddingTop="25"/>
              <s:HTTPService id="nepInfo" url="http://www.epa.gov/owow/estuaries/nep_info.xml"/>
              <!--s:RadioButtonGroup id="optiongroup"/-->
          <s:Panel title="NEP Project Information">
              <s:HGroup verticalAlign="middle">
          <mx:Form x="188" y="34" width="338">
          <mx:FormItem label="Search for NEP Information:">
          <s:DropDownList enabled="true" id="dropDownList" prompt="Select NEP" dataProvider="{nepInfo.lastResult.records.record}" labelField="nepName">
              <mx:DataGrid id="resultsGrid"
                           visible="{dropDownList.selectedItem != null}" x="20" y="62" width="1166" height="620">
                      <mx:DataGridColumn dataField="projectName" headerText="Project Name" wordWrap="true"/>
                      <mx:DataGridColumn dataField="projectDescription" headerText="Project Description" wordWrap="true"/>
                      <mx:DataGridColumn dataField="acres" headerText="Acres" wordWrap="true"/>
                      <mx:DataGridColumn dataField="habitatDescription" headerText="Habitat Description" wordWrap="true"/>
                      <mx:DataGridColumn dataField="neportCategory" headerText="Habitat Category" wordWrap="true"/>
                      <mx:DataGridColumn dataField="restorationType" headerText="Restoration Type" wordWrap="true"/>
                      <mx:DataGridColumn dataField="leadPartner" headerText="Lead Partner" wordWrap="true"/>


      XML: http://www.epa.gov/owow/estuaries/nep_info.xml


      Thank you in advance for your help!