[thelist] Sorting 2D Array in ColdFusion

Michael Buffington mike at price.com
Tue Nov 28 16:58:14 CST 2000


I managed to convince the admin to install CF 4.5.1 SP2.

Your idea worked like a charm.  Thanks!

Michael Buffington
mike at price.com
(714) 556-3890 x222
http://www.price.com 
http://www.michaelbuffington.com

-----Original Message-----
From: Raymond K. Camden [mailto:rcamden at allaire.com]
Sent: Tuesday, November 28, 2000 1:32 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] Sorting 2D Array in ColdFusion


Why not treat column 1 as a structure?

Ie,

struct["2303"] = 3
struct["..."] = x

Then you can simply use StructSort (new to CF 4.5.1 SP2) to sort the
structure.

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : jedimaster at allaire.com
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda


> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Michael Buffington
> Sent: Tuesday, November 28, 2000 4:25 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] Sorting 2D Array in ColdFusion
>
>
> I need to sort values in a 2D ColdFusion array.
>
> By itself, this is a simple task, but it get's tricky. I'm
> converting a text
> file that looks like this...
>
> 2303,3
> 2390,1
> 2302,2
>
> ...into a 2D array that looks like this:
> col1 col2
> 2303 3
> 2390 1
> 2302 2
>
> My intent is to sort the values to look like this:
> col1 col2
> 2390 1
> 2302 2
> 2303 3
>
> I cannot use ArraySort(myArray[2]) because that will only sort col2.
>
> Any ideas?
>
> I may have to back track a good distance and loosen my dependence on this
> data structure, but I can't think of an alternative just yet.
>
> Michael Buffington
> mike at price.com
> (714) 556-3890 x222
> http://www.price.com
> http://www.michaelbuffington.com
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt ! 




More information about the thelist mailing list