Hi All, How can I consolidate or merge the same items from an arrayCollection into one but summary the fields with numbers? example: [Bindable] private var acSample:ArrayCollection = new ArrayCollection([ {Fname: "Kranthi", Lname:"Kata", dob:"21/10/1972", Amount_1:10000, Amount_2:10}, {Fname: "Vasanth", Lname:"Lola", dob:"12/01/1980", Amount_1:5000, Amount_2:20}, {Fname: "Vasanth", Lname:"Lola", dob:"12/01/1980", Amount_1:5000, Amount_2:30}, {Fname: "Sample1", Lname:"Lola", dob:"12/01/1982", Amount_1:10000, Amount_2:40} ]);
The result arrayCollection should display 3 unique records, but sum Amount_1 and Amount_2 for record Vasanth I found this: public static function getDisticntArrayCollection(sourceCollection:ArrayCollection):ArrayCollection{ var distinctValuesCollection:ArrayCollection = new ArrayCollection(); for each(var item:* in sourceCollection){ var propertyValue:Object = item.VALUE; if(distinctValuesCollection.getItemIndex(propertyValue) == -1) distinctValuesCollection.addItem(item); } return distinctValuesCollection; } I try to replace the item.VALUE with Fname but always get the same records. thanks for your help in advanced. Best, -- View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Consolidate-items-from-ArrayCollection-tp13509.html Sent from the Apache Flex Users mailing list archive at Nabble.com.