Thanks for your reply and help.
I got it, my only concern is that I have 40K records and i hope this is a
fast way.

[Bindable] private var acResult:ArrayCollection = new ArrayCollection();

private function groupAndSumArray(ac:ArrayCollection, key:String):void
                        {
                                var acLength:Number = ac.length;
                                var flag: Boolean;
                                
                                for (var i: int = 0; i < acLength; i++) {
                                        flag = false;
                                        for (var j: int = 0; j < 
acResult.length; j++) {
                                                if (acResult.getItemAt(j)[key] 
== ac.getItemAt(i)[key]) {
                                                        
acResult.getItemAt(j)["Amount_1"] += ac.getItemAt(i)["Amount_1"];
                                                        flag = true;
                                                        break;
                                                }
                                        }
                                        if (!flag) {
                                                
acResult.addItem(ac.getItemAt(i));
                                                acResult.refresh();
                                        }
                                }
                        }



--
View this message in context: 
http://apache-flex-users.2333346.n4.nabble.com/Consolidate-items-from-ArrayCollection-tp13509p13517.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply via email to