On 12/20/00, Jay Brushett penned:
>Hi,
>
>I need to use the Evaluate function to dynamically name variables in a
><cfloop>.
>Using the function on the right hand side of a cfset works fine of course
>but CF won't let me use it on the left hand side (i.e. the variable name).
>
>Any ideas would be greatly appreciated.
This will show you using randrange as the value were setting each one
at. I'd preume you're looping through a list or whatnot to get the
values. This will name the variables var1, var2, var3, etc.
<cfloop index="num" from="1" to="10">
<cfset random = randrange(100, 200)>
<cfset varname = "var" & num>
<cfset "#varname#" = random>
<CFOUTPUT>variable #num# = #evaluate(varname)#<br></CFOUTPUT>
</cfloop>
--
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists