3 Replies Latest reply on Jun 14, 2009 11:43 AM by leybniz

    Combining Duplicate XML nodes in ComboBox

    a1bedell

      Hello,

       

      I'm working on populating a combobox and various other controls with the XML data below. Where I'm stuck is that I loaded the XML and I can get the node I want to populate to combobox but I can't get it to combine the duplicate values. For example, if the value is ETHNICITY from below I get 4 options in the comobobox rather than 2 as Caucasian is the same value 3 times.

       

      I was able to eliminate duplicate values if the values were numbers but not strings. I guess a larger question for my own learning would be is the XML data the best form to populate the combobox? Or should I be converting the data anyway.

       

      Thanks,

      Auzzie

       

      Here is my combobox:

      private var xmlItems:XML;

       

      <mx:ComboBox dataProvider="{xmlItems.HEADSHOT.(@id).ETHNICITY}"/>

       

      Here is a sample of my XML:

           <CATALOG>

                <HEADSHOT id="001-00006">
                        <SEX>Female</SEX>
                        <AGE>30</AGE>
                        <ETHNICITY>African-American</ETHNICITY>
                        <HEIGHT>5-9</HEIGHT>
                        <WEIGHT>130</WEIGHT>
                        <HAIR>Black</HAIR>
                        <EYES>Brown</EYES>
                        <DATE>02-22-2009</DATE>
                     </HEADSHOT>
                     <HEADSHOT id="001-00007">
                        <SEX>Female</SEX>
                        <AGE>32</AGE>
                        <ETHNICITY>Caucasian</ETHNICITY>
                        <HEIGHT>5-4</HEIGHT>
                        <WEIGHT>110</WEIGHT>
                        <HAIR>Blonde</HAIR>
                        <EYES>Blue</EYES>
                        <DATE>02-22-2009</DATE>
                     </HEADSHOT>
                     <HEADSHOT id="001-00008">
                        <SEX>Male</SEX>
                        <AGE>69</AGE>
                        <ETHNICITY>Caucasian</ETHNICITY>
                        <HEIGHT>5-8</HEIGHT>
                        <WEIGHT>170</WEIGHT>
                        <HAIR>Gray</HAIR>
                        <EYES>Blue</EYES>
                        <DATE>02-22-2009</DATE>
                     </HEADSHOT>
                     <HEADSHOT id="001-00009">
                        <SEX>Female</SEX>
                        <AGE>26</AGE>
                        <ETHNICITY>Caucasian</ETHNICITY>
                        <HEIGHT>5-4</HEIGHT>
                        <WEIGHT>105</WEIGHT>
                        <HAIR>Blonde</HAIR>
                        <EYES>Green</EYES>
                        <DATE>02-22-2009</DATE>
                     </HEADSHOT>

           </CATALOG>