If you want ThisVar to contain the value stored in Client.lr#numvar#, then I
think you need to do an Evaluate on it.  Otherwise ThisVar is going to be
equal to "Client.lr1".  Also (although this wouldn't be causing a problem)
you don't need those # signs inside your <CFIF> tag.

Bob

-----Original Message-----
From: S R [mailto:[EMAIL PROTECTED]]
Sent: December 11, 2000 4:59 PM
To: CF-Talk
Subject: LOOP AND VARIABLE QUESTION


I have this loop below pulling from a database. As you can see, the <select>
part of the loop does exactly what I want it to. It dynamically creates lr1,
lr2, lr3, lr4, lr5, etc. The problem I am now having is where the <CFIF>
statement is. I need that to do exactly what the <CFIF> statement is telling
it to do but it does not. Right now, each module automatically defaults to
choice 1 because the #id# and/or #ThisVar# variable is not being fed to the
CFIF statement. How can I accomplish this??

Sal

<CFSTOREDPROC datasource="#application.Datasource#" dbname="UserPreferences"
procedure="GetChoices">
<cfprocresult name="GetChoices">
</CFSTOREDPROC>

<CFSTOREDPROC DATASOURCE="#application.datasource#" DBNAME="UserPreferences"
PROCEDURE="sp_GetLRCount">
<CFPROCRESULT NAME="GetLRCount">
</CFSTOREDPROC>

<CFSET LeftLoop = #GetLRCount.LRNumber#>

<CFLOOP INDEX="i" FROM="1" TO="#LeftLoop#">

<CFSET numvar = i>
<CFSET ThisVar = "Client.lr#numvar#">

<cfoutput><select name="lr#i#"></cfoutput>
<cfoutput query="GetChoices">


<option value="#id#" <cfif #id# is
#ThisVar#>SELECTED</CFIF>>#ChoiceName#</option>
</cfoutput>
</select>

<p>

</CFLOOP>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        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

Reply via email to