[thelist] ColdFusion - 2 dimensional array sort

jon steele jjsteele22 at yahoo.com
Sat May 26 13:01:55 CDT 2001


Hi,

I have a 2d array like this:

<cfset arr[1][1] = "30">
<cfset arr[1][2] = "text text">

<cfset arr[2][1] = "14">
<cfset arr[2][2] = "text text">

<cfset arr[3][1] = "25">
<cfset arr[3][2] = "text text">

OUPUT WHEN LOOPING THROUGH:
30 - text text
14 - text text
25 - text text

Now I want to sort the array using the first element in the second
"dimension" (if that's what you call it)... that is, using the numeric
value. So the output when looping throught is this:

14 - text text
25 - text text
30 - text text

So the ENTIRE array element arr[#] is sorted using arr[#][1]. Make
sense? I've been trying different things and keep getting errors.

Thanks,
Jon.

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




More information about the thelist mailing list