change
<cfloop collection="#application.translate#" item="field">
to
<cfloop list="#listSort(structKeyList(application.translate),
"textnocase")#" index="field">


and it'll sort it for you.  I bet that's what CFDUMP does internally.

  _____  

From: Shawn McKee [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 1:59 PM
To: CF-Talk
Subject: CFMX and a collection loop problem

We store language translations for our site in an XML file that we load into
an application variable like this.

<cffile action="" file="#attributes.xmlfile#" variable="wddxpacket">
<cfwddx action="" input="#wddxpacket#"
output="application.translate">

In CF5.x we access via a loop to make an editing interface.

<cfset lastletter = '@'>
<cfloop collection="#application.translate#" item="field">
   <cfif mid(field,1,1) NEQ lastletter AND mid(field,1,1) NEQ '1'>
      <cfset lastletter = mid(field,1,1)>
      <cfset anchorhref = '##'&lastletter>
      <cfoutput>
         <input type="Radio" name="letter" value="#lastletter#"
size="+1"
color="##000080">#lastletter#</font>
      </cfoutput>
   </cfif>
</cfloop>         

This then prints out a nice list of the letters of the alphabet that have
content.  All works great in CF5 but under MX the fields are brought back in
a pseudo random order.  If I do a <cfdump> of the application variable it is
just fine it is only inside the loop that I have problems.

Shawn
www.newsstand.com
  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to