I'm trying to populate a dataProvider array for a comboBox that 
contains unique status values from another array, that is used as 
the dataProvider for a dataGrid.  The comboBox is used to filter the 
dataGrid.  The code below works, but I seem to remember seeing this 
done somewhere that doesn't use nested for statements.  Does anyone 
know how I can identify if the array's status value already exists 
in the new status array without iterating the new array every time?

      public function populateStatusArray(array:Array):void {
                
            var status : Array = new Array;
            status.push("All");
                
            var n:int = citations.length;
            for (var i:int = 0; i < n; i++) {
                var m:int = status.length;
                var found:Boolean = false;
                for (var j:int = 0; j < m; j++) {
                        if (status[j] == array[i].status){
                                found = true;
                        }
                }
                if (found == false) {
                        status.push(array[i].status);
                }
            }           
            status.sort();
            ModelLocator.getInstance().statusArray = status;        
        }

Thank You,
Tim Hoff






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to