[thelist] CF: De-duplicating Arrays

Frank lists at frankmarion.com
Tue Jul 15 08:39:40 CDT 2003


At 05:52 AM 2003-07-15 -0700, you wrote:
>I threw something together real quick and dirty after reading your email 
>that does the job using just arrays. No list conversion or anything. It 
>runs pretty quick, although I haven't compared it to doing arrays to lists 
>then back to arrays again.

Wow Michael, that' s pretty amazing of you. Thanks!


>Here's a question though: which of the two dupes do you keep if the values 
>in the second dimension are different? My functions below keep the first 
>occurrence of a dupe, and prevent the second from being set to the array. 
>Also, the code only works for 2D arrays here, but could very easily be 
>used for a single dimension. Also, the code for the ArrayFind function is 
>not my own, although I modded it some. I lost track of who did it, but I 
>use it quite often, it's quite handy.

For this particular case, I don't really care about the second 
dimension.  I simply wanted to be able to get one of each from an already 
existing array.  It's a matter of top lining for a report. The first 
dimension is actually a client number, and the second dimension is a 
variety of contact details (phone, email, ect...) The purpose in the case 
was to say "client (array[1]) paid up today".

Quick question: is the ability to use myFunction()  available in 4.5's 
version of cfscript? If so, I've just learned something that'll change a 
lot for me. If it's not, this will be a most excellent guide for converting 
to tags.

Incidentally, I was looking at some code on cflib.org to guide me, 
ArrayFind is at <http://www.cflib.org/udf.cfm?ID=715>

Thanks Michael that's incredibly helpful, I was busting my skull on it.


--
Frank Marion     lists at frankmarion.com      Keep the signal high.  



More information about the thelist mailing list