I never would have expected casting an object to a String would return a
usable string! (will be interested to try it and look at the string!)

If there was a "key" field in the data provider, you could use the same
technique using the key value in place of String(item).

Tracy

-----Original Message-----
From: Manish Jethani [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 03, 2005 4:34 AM
To: [email protected]
Subject: Re: [flexcoders] dataProvider row filtering / suppressing


goran187 wrote:

> I am trying to go through the rows of a dataProvider and make sure 
> there are no duplicate records. Do you know of an easy way to do this 
> (maybe a built in function?)

Use a hash table. AS2 objects are like hash tables.

var uniqueItems = {};
for (var i:Number = 0; i < myDataProvider.length; i++)
{
var item = myDataProvider.getItemAt(i);
uniqueItems[String(item)] = item;
}

Now you can iterate through the values to get the unique items. The code

assumes that identical items have identical string representations.

Manish


 
Yahoo! Groups Links



 







Reply via email to