I have a query with dynamically named columns.  As such, I need to
loop inside a loop, as so (omitting bunches of stuff, just get the
idea):

<cfloop query="QueryValues">
    <tr>
          <cfloop query="QueryColumns">
               <td>#ReturnValueForColumn#</td>
          </cfloop>
     </tr>
</cfloop>

Now this doesn't really work due to the funky behaviour with CF
relating to not refreshing the data for the outer loop.  The results
from the above will get me the ReturnValueForColumn values repeated
for the first row of QueryValues.  So if QueryValues returns:
1, Bob | 2, Jane | 3, Joe,

I will get 1, Bob | 1, Bob | 1, Bob.

Now the way around this is to set the value of each
ReturnValueForColumn before the inner loop, like so:

<cfloop query="QueryValues">
     <!--- Set Variable Here --->
     <tr>
          <cfloop query="QueryColumns">
               <td>#ReturnValueForColumn#</td>
          </cfloop>
     </tr>
</cfloop>

Here-in is where I am running into issues.  Before my inner loop, I
have tried setting the value of the variable in the inner loop these
two ways:

<cfset variables.ReturnColumnName = "QueryColumn" &
variables.FormFieldAttributeID>
<cfset 
"ReturnFormFieldValue#i#"=qryGetFormFieldValue[variables.ReturnColumnName]>

or 

<cfset "ReturnFormFieldValue#i#" =
Evaluate("qryGetFormFieldValue.QueryColumn" &
variables.FormFieldAttributeID)>

Using method number 1, I get: 1, Bob | 1, Bob | 1, Bob

Using method number 2, I get: 1, Bob | 2, Jane | 3, Joe

What is it about method number 2 that causes the value to be set, but
method number 1 won't reset the value when it goes back through the
loop?

Chad
who thinks the "dead" possum in his ceiling just had bad gas

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to