Thanks Kym.  

After muttering many smite-able statements, I figured that out.  This
old post also helped:
http://www.houseoffusion.com/cf_lists/messages.cfm/forumid:4/threadid:2039

Problem is that I don't know my column names in the first query until
I am looping in my second query.  Yeah, sounds complex, but I'm
working with abstraction to the nth degree.

I have ended up looping through the second query to capture the value
I want in a dynamically named variable.

Then, after looping through my first query and before the second, I
store the column name in another dyncamically named variable, like so:

<cfloop index="i" from="1" to="#NumberOfFormFields#">
                                <cfset "ReturnFormFieldValue#i#" =
Evaluate("MyRowQuery.QueryColumn" & evaluate("ReturnAttributeID" &
i))>
</cfloop>

Then in the second query:

<cfset variables.FormFieldDefaultValue =
Evaluate("ReturnFormFieldValue" & variables.IndexNo)>

Any help on proper syntax to eliminate those annoying Evaluates using
CF5 and CF7 would be most appreciated.

Cheers,

Chad
who has to go to his own birthday party now.

On 6/5/05, Kym Kovan <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> Chad Renando wrote:
> > Hey all.  I am looping through one query to create rows in a table,
> > and then, due to the first query having dynamic column names, looping
> > through another to create the columns.  So:
> >
> > <cfloop query="MyRowQuery">
> >      <tr>
> >           <cfloop query="MyColumnQuery">
> >                <td>Stuff</td>
> >           </cfloop>
> >      </tr>
> > </cfloop>
> >
> > Problem is that it is only spitting out the values from the first
> > record of MyRowQuery.  So for example, if I manually spit out "Stuff"
> > before the MyColumnQuery, it shows the correct data for MyRowQuery,
> > like: Stuff1, Stuff2, Stuff3.
> >
> > But when I try to output the data from MyRowQuery inside
> > MyColumnQuery, I get MyStuff1, MyStuff1,MyStuff1.
> 
> It a standard "scoping" issue due to the way CF handles queries inside
> queries. You need to put the data that you want to show/use inside the
> second loop into a variable scope variable in the first loop before you
> get to the second loop. That make sense? (brain not allowed to work
> properly on a Sunday).
> 
> Your code needs to look like:
> 
>   <cfloop query="MyRowQuery">
>     <cfset thisRowVar = MyRowQuery.stuff>
>        <tr>
>             <cfloop query="MyColumnQuery">
>              <!--- thisRowVar - is now valid --->
>                  <td>Stuff</td>
>             </cfloop>
>        </tr>
>   </cfloop>
> 
> 
> > Cheers,
> >
> > Chad
> > who is risking being smitten by coding on the Sabbath
> 
> Don't worry, most of us would be charcoal by now if that was true :^)
> 
> 
> Kym K
> 
> 
> ---
> 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/
>

---
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