Is there a way to dynamically create a variable
the following code segment throws exception. can define parameter using following code, not work me. need dynamically define x number of local variables. syntax off here, or there way accomplish this? in advance.
<cfloop index = "i" = "1" = "#attributes.x#">
<cfset=var#i#>
</cfloop>
<cfloop index = "i" = "1" = "#attributes.x#">
<cfset=var#i#>
</cfloop>
you need use variables scope local variables.
<cfloop index = "i" = "1" = "#attributes.x#">
<cfset variables["var" & i] = something>
</cfloop>
<cfloop index = "i" = "1" = "#attributes.x#">
<cfset variables["var" & i] = something>
</cfloop>
More discussions in ColdFusion
adobe
Comments
Post a Comment