There's also a tag on the DevEx called MD_Array_Sort.
(One undocumented "feature" is that I think you have to specify at
least two sort fields)
>From the docs:
Description
This tag will sort a 2D Array on the specified column(s). The tag will
sort based on one or more columns. If a column is not selected the tag
will sort the array on the first column of the array. The tag will
sort in either ascending or descending order depending on what is
specified. Ascending is the default sort order though. It is assumed
that all arrays will be comprised of a combination of text, numbers
and / or dates so all sorts will be text based sorts. The tag allows
you to specify case sensitivity though.
<CF_MD_Array_Sort
Array_Name = #Name_of_the_array_to_sort#
Sort_Order= 1,4,3
Asc_Desc = 'Asc'
Sort_Type = 'text'>
Jamie
On Fri, 30 Nov 2001 13:53:32 -0500, "Adkins, Randy"
<[EMAIL PROTECTED]> wrote:
>Thanks.. I will convert it to a Struct
>instead. I could slap myself for not
>doing so in the first place.
>
>Been a long day........
>
>
>
>-----Original Message-----
>From: Raymond Camden [mailto:[EMAIL PROTECTED]]
>Sent: Friday, November 30, 2001 1:55 PM
>To: CF-Talk
>Subject: RE: ArraySort
>
>
>ArraySort is for 1D arrays. It looks like you are using 2d arrays where
>structs may be better. Consider rewriting as:
>
><CFSET myArray = ArrayNew(1)>
><CFSET myArray[1] = StructNew()>
><CFSET myArray[1].FirstName="John">
><CFSET myArray[1].LastName="Doe">
>etc
><CFSET myArray[2].FirstName="Barry">
>etc
>
>Then use StructSort to sort.
>
>=======================================================================
>Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
>
>Email : [EMAIL PROTECTED]
>Yahoo IM : morpheus
>
>"My ally is the Force, and a powerful ally it is." - Yoda
>
>> -----Original Message-----
>> From: Adkins, Randy [mailto:[EMAIL PROTECTED]]
>> Sent: Friday, November 30, 2001 1:45 PM
>> To: CF-Talk
>> Subject: ArraySort
>>
>>
>> This is something that I serious MUST be overlooking.
>> Eyes are bloodshot right now from coding.
>>
>>
>> I have a 2 dimential array such as follows:
>>
>> myArray[1][1] = 'JOHN'
>> myArray[1][2] = 'DOE'
>> myArray[1][3] = '[EMAIL PROTECTED]' <mailto:'[EMAIL PROTECTED]'>
>> myArray[1][4] = 'TEXAS'
>> myArray[1][5] = 'USA'
>>
>> myArray[2][1] = 'BARRY'
>> myArray[2][2] = 'JOHNSON'
>> myArray[2][3] = '[EMAIL PROTECTED]'
>> <mailto:'[EMAIL PROTECTED]'>
>> myArray[2][4] = 'CALIFORNIA'
>> myArray[2][5] = 'USA'
>>
>> I need to SORT the array before outputting the data.
>> Sounds simple right???
>>
>> It should come out:
>> BARRY JOHNSON
>> JOHN DOE
>>
>> When using the command:
>> <cfset sortit = ArraySort(myarray,"textnocase")>
>>
>> Question #1:
>> When using the ArraySort, it should evaluate all the
>> dimensions with in
>> the array for sorting, correct?
>> OR does it only sort on ONE dimension?
>>
>> Question #2:
>> When using the command above, why do I get the following error:
>>
>> Error Occurred While Processing Request
>>
>>
>>
>>
>>
>> Error Diagnostic Information
>>
>>
>>
>> An error occurred while evaluating the expression:
>>
>>
>>
>> sortit = ArraySort(myarray,"textnocase")
>>
>> Error near line 245, column 8.
>>
>> The expression has requested a variable or an intermediate
>> expression result
>> as a simple value, however, the result cannot be converted to a simple
>> value. Simple values are strings, numbers, boolean values,
>> and date/time
>> values. Queries, arrays, and COM objects are examples of
>> complex values.
>>
>> The most likely cause of the error is that you are trying to
>> use a complex
>> value as a simple one. For example, you may be trying to use a query
>> variable in a <CFIF> tag. This was possible under Cold Fusion
>> 2.0 but is an
>> error under later versions.
>>
>>
>>
>> Randy Adkins
>> Tech Lead - Novient
>> SRA International
>> [EMAIL PROTECTED]
>> (703) 803-1677
>>
>>
>>
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists