Incidentally MX also introduced StructSort() which does the same thing
for the collection loop because CF5 collection loops used to be sorted
automatically and they figured this was the fix (I've never understood
why they didn't just make this automatic in the cfloop tag for
backward compatibility.) ...

<cfloop collection="#structSort(myStruct)#" item="i">
  #myStruct[i]#
</cfloop>

> The order of a struct's elements is undefined.  If you
> want an ordered
> collection, use an array.  If you really need an ordered
> struct (I'm
> sure there's a legit reason somewhere), you'd have to make
> some kind
> of complex data type that combines a struct and an array.

> Note that these two loops are equivalent:

> <cfloop collection="#myStruct#" item="i">
>   #myStruct[i]#
> </cfloop>

> <cfloop list="#structKeyList(myStruct)#" index="i">
>   #myStruct[i]#
> </cfloop>

> The latter can have a listSort wrapped around the
> structKeyList to
> sort the keys which may or may not solve your problem,
> depending on if
> the desired key order can be expressed with an alphabetic
> sort.

> cheers,
> barneyb


> On Thu, 10 Mar 2005 14:33:02 -0500, Damien McKenna
> <[EMAIL PROTECTED]> wrote:
>> I've got a structure like so:
>>
>> Events[]
>>      "ARSG90IFNwcmluZ3M=7"
>>      "MITGFtYXI=3"
>>      "TXQXJsaW5ndG9u5"
>>
>> Yes, the elements are base64 encoded.
>>
>> Anyway, I do a dump of the structure before running it in
>> cfloop and it
>> is in the correct order that I want.  Then I run this:
>>
>> <cfloop collection="#Events#" item="EventID">
>>     stuff in here
>> </cfloop>
>>
>> However the cfloop query outputs the data in a different
>> order, putting
>> the TX value first, then AR then MI.  Is something going
>> wrong or am I
>> missing a step?
>>
>> Thanks.
>>
>> --
>> Damien McKenna - Web Developer -
>> [EMAIL PROTECTED]


> --
> Barney Boisvert
> [EMAIL PROTECTED]
> 360.319.6145
> http://www.barneyb.com/

> Got Gmail? I have 50 invites.

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:198255
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to