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

--- In flexcoders@yahoogroups.com, "markgoldin_2000" 
<markgoldin_2...@...> wrote:
>
> For this simple XML:
> <root>
>   <data>
>    <filter>f1</filter>
>    <value>1</value>
>   </data>
>   <data>
>    <filter>f1</filter>
>    <value>2</value>
>   </data>
>   <data>
>    <filter>f2</filter>
>    <value>3</value>
>   </data>
> </root>
> is it possible to retrieve unique values of an element "filter"?
> 
> Thanks
>


Reply via email to