Structures do not output in a specific order. If you need alphabetical display then you'll have to use another data type.
-----Original Message----- From: Tom King [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 08, 2007 9:26 AM To: CF-Talk Subject: Outputting structs Hi All, i've created a struct which when outputted, outputs in the 'wrong order' If you run the code below when you're in a subdirectory, i.e: /home/mydir1/mydir2/somepage.cfm each dir and page name is added to the struct in order: When I dump the struct, it comes out in the correct order, but when I loop it as a collection, it comes out in a wierd order? I know that structs don't have exact row numbering, but can anyone tell me why the dump order is different to the actual outputted order? Thanks T <cfsilent> <cfscript> //Create a struct to play with Bread.struct=StructNew(); //Set our root location currentlocale="/"; </cfscript> <!---CGI.SCRIPT_NAME is the var with the current location in---> <cfloop list="#cgi.SCRIPT_NAME#" delimiters="/" index="i"> <cfscript> //Insert the looped value into the struct, replacing underscores and .cfm //The keyname becomes the URL, and the keyvalue is the text to link StructInsert(Bread.struct, "#currentLocale##i#", "#replace(replace(i, '_', ' ', 'all'), '.cfm', '', 'all')#"); //Update currentlocale, which acts as the string to update currentlocale="#currentLocale##i#/"; </cfscript> </cfloop> </cfsilent> <!---For demo purposes, dump the struct - note the order---> <cfdump var="#bread#"> <!---Output the struct---> <cfoutput> <div> <p> <cfloop collection="#bread.struct#" item="i"> <cfoutput> <a href="#i#">#bread.struct[i]#</a> > </cfoutput> </cfloop> <p> </div> </cfoutput> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:277279 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

