Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
philh #1
Re: Using cfloop to intialize variables
<cfloop index="i" from="1" to="29">
<cfset "Q#i#1" = 0>
<cfset "Q#i#2" = 0>
<cfset "Q#i#3" = 0>
</cfloop>
<cfloop index="i" from="1" to="29">
<cfset thisvar = #evaluate("'Q'&i&'1'")#>
<cfoutput>#evaluate("'Q'&i&'1'")# - #evaluate(thisvar)#<br></cfoutput>
</cfloop>
philh Guest
-
cfloop
The goal is to insert a record into table 'atd', which contains a document id and an associate id, for each document (38) and associate (150). So... -
Cfloop..
I am trying to loop over a list: <cfquery name="updsyllabus" datasource="#arguments.syl.dsn#"> UPDATE #arguments.syl.tname# SET <cfloop... -
to cfloop or not to cfloop?
:confused; I have a list of checkboxes from a form, and a submit button for "Batch Print" The var is "SelectList" and comes out as comma dilimited.... -
cfloop from query
Hi there! I need a little help here. I have to change 'TraveAgencyNumber' to 'TravelAgencyName' Through this query output (GetLog) I only get the... -
CFLOOP and dynamic variables
Hi, have a simple problem - and I cannot find a simple answer! I am looping through a list of fields returned from a form. FORM.FIELDLIST via... -
Adam Cameron #2
Re: Using cfloop to intialize variables
> <cfset Q#i#1 = 0>
Possibly because it's invalid syntax, I should think ;-)> But, I get an error on the pound sign. Any idea why?
Try this:
<cfset "Q#i#1" = 0>
[url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000334.htm[/url]
--
Adam
Adam Cameron Guest
-
DaSpaz #3
Re: Using cfloop to intialize variables
While this method did create all the variables, instead on each variable equaling zero, it equals it's name. So, the value of variable Q11 is Q11, value of Q12 is Q12, etc.
DaSpaz Guest
-
Adam Cameron #4
Re: Using cfloop to intialize variables
You don't need to do this.> <cfset thisvar = #evaluate("'Q'&i&'1'")#>
<cfset thisvar = variables["Q#i#1")>
Similarly here.> <cfoutput>#evaluate("'Q'&i&'1'")# - #evaluate(thisvar)#<br></cfoutput>
I would say that about 95% of the time that you might think you need to use
evaluate(), you really don't need to.
--
Adam
Adam Cameron Guest



Reply With Quote

