--- In flexcoders@yahoogroups.com, "ilikeflex" <ilikef...@...> wrote:
>
> Few months back i have the same requirement. I created function
> 
> getUniqueElements(workListErrorFlag,"flag").
> 
> This function takes the XMLList and the xml node name for which you 
> want the unique elements.In your case it should be "filter" .It may 
> be possible that you have to make some small chnages.
> 
> 
> private function getUniqueElements
> (list:XMLList,xmlTag:String):XMLListCollection
>               {
>                       var xmlCollection:XMLListCollection = new 
> XMLListCollection();
>                       var uniqueEvents:ArrayCollection = new 
> ArrayCollection();
>                       
>                       for each( var systemxml:XML in list)
>                       {
>                               var system:String = systemxml.children
> ().length() > 1 ? systemxml[xmlTag].toString():String
> (systemxml.toString());
>                               if ( !uniqueEvents.contains(system) )
>                               {
>                                       uniqueEvents.addItem(system);
>                                       xmlCollection.addItem(new XML
> (<{xmlTag}>{system}</{xmlTag}>));
>                               } 
>                       }
>                       return xmlCollection;
>                       
>               }
> 
> 
> HTH
> ilikeflex

Here's another take that uses an AS function in an e4X expression:
http://joshblog.net/2007/05/17/filter-xml-data-with-e4x-in-flash-part-
2/

Reply via email to