> What is the correct syntax to be used when looping > over a struct? It shouldn't matter if I'm treating > the struct as an associative array, should it? The > syntax from the CF 4.01 docs show the first method. > > 1. <cfloop item="agentid" collection=agents> > 2. <cfloop item="agentid" collection="agents"> > 3. <cfloop item="agentid" collection="#agents#">
The third one is the only one which works. The syntax used in the first example works occasionally in other CFML tags (the obvious example being CFSET) but not within all of them. The syntax used in the second one won't ever work with this or other tags, because it's referring to a literal string with a value of "agents". The first one is not referring to a literal string, and the third one is referring to a literal string, but within that string the variable agents is being evaluated. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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

