1 Reply Latest reply on May 7, 2007 3:42 PM by cheftimo

    ArrayCollection without Duplicates

    aalazzani
      I am new to using Flex and I have a data source QueryResult that has records with duplicates. I want to add ONLY UNIQUE records into an ArrayCollection. I am using the following code to eliminate duplicates but still I am getting duplicates in the resulting ArrayCollection.

      for (var j:int=0;j<qr1.records.length;j++) {
      if ((pairs.contains( {Score1:qr1.records[j].Score__c,Tier1:qr1.records[j].Tier__c} )) == false){
      pairs.addItem( { Score1:qr1.records[j].Score__c, Tier1:qr1.records[j].Tier__c } );
      }
      }

      Any ideas why this is happening and how can I fix it?

      Thanks in advance,

      Aref