Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

correct variable within variable syntax

Status
Not open for further replies.

twcman

Programmer
Jun 28, 2001
284
US
OK, I do not do this often enough to remember the syntax for the following loop sequence:

<cfloop index=&quot;i&quot; from=&quot;1&quot; to&quot;3&quot; step=&quot;1&quot;>
<CFQUERY datasource=&quot;#datasource#&quot; name=&quot;att#i#vals&quot;>
SELECT * FROM Attributes
WHERE Attribute = '#attsarray#'
</cfquery>
<cfset selectlist#i# = #ListToArray('att''vals.AttValues')#>
</cfloop>

It is throwing an error on the cfset statement. Not sure if previous statements are correct though.

Thanks....

Chris Scott
The Whole Computer Medical Systems
 
Put the variabe name inside some quotes, should get you closer:
Code:
<CFLOOP index=&quot;i&quot; from=&quot;1&quot; to&quot;3&quot; step=&quot;1&quot;>
   <CFQUERY datasource=&quot;#datasource#&quot; name=&quot;att#i#vals&quot;>
        SELECT * FROM Attributes 
        WHERE Attribute = '#attsarray[i]#'
   </CFQUERY >
   <CFSET &quot;selectlist#i#&quot; = ListToArray('att''vals.AttValues')>
</CFLOOP>
I'm not sure what you're doing with your ListToArray function, though... &quot;att&quot; doesn't seem to be a list, and &quot;vals.AttValues&quot; would be an odd delimiter (not to mention you're missing a comma in there somewhere).



-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top