1 Reply Latest reply on Sep 8, 2009 3:27 PM by Lochdonan

    Unique XMLList

    Lochdonan

      I am trying to create a unique list of contact from an XMLList containing:

      <strcnt>
        <cym>200808</cym>
        <concept>XXXX</concept>
        <brand/>
        <max>12</max>
        <min>12</min>
        <start>12</start>
        <end>12</end>
      </strcnt>
      <strcnt>
        <cym>200809</cym>
        <concept>XXXX</concept>
        <brand/>
        <max>12</max>
        <min>12</min>
        <start>12</start>
        <end>12</end>
      </strcnt>
      <strcnt>
        <cym>200810</cym>
        <concept>XXXX</concept>
        <brand/>
        <max>12</max>
        <min>13</min>
        <start>12</start>
        <end>13</end>
      </strcnt>
      <strcnt>
        <cym>200811</cym>
        <concept>XXXX</concept>
        <brand/>
        <max>13</max>
        <min>13</min>
        <start>13</start>
        <end>13</end>
      </strcnt>

       

      When I try to get a list of concepts that is just an arrayCollection of

      XXXX

      YYYY

      ZZZZ

       

      to put into a drop down box for drill down abilities.

       

      Here is my last attempt to accomplish this:

       

       

       

       

       

      listtest = countsInfo.strcnt.(brand ==

      "") as XMLList;      // countsInfo is what is comming from the webservice

       

       

      listtest.descendants().(listtest1 = addUniqueValue(child("concept"),listtest.concept));

       

       

       

       

      with addUniqueValue as:

       

       

       

       

       

      private function

      addUniqueValue(value:Object, list:XMLList):XMLList

      {

       

       

      if (!list.contains(value))

      {

      list += value;

      }

       

       

      return list;

       

      What am I doing wrong?

       

      Thank you in advance for any help.

      Lochdonan