output in nested cfloop
3 Message(s) by 2 Author(s) originally posted in cfml discussion
| From: wolfv |
Date: Friday, October 26, 2007
|
The attached
code only prints the first
record of q_1.
Seems that the q_1 record counter is rest on every
loop of q_2.
Is there a way to turn off the reset?
Thank you.
<CFLOOP> query="q_1">
<CFLOOP> query="q_2">
ID1=
<CFOUTPUT>#q_1.id#
<CFOUTPUT>:
<!--- only prints the first record of q_1
--->
ID2=
<CFOUTPUT>#q_2.id#
<CFOUTPUT>,
</CFLOOP>
<br />
</CFLOOP>
| From: Dan Bracuk |
Date: Friday, October 26, 2007
|
You've to specify
row numbers. The
syntax is:
queryname.fieldname[rownumber]
By the way, put your CFOUTPUT tags outside your loops. Having them inside is inefficient.
| From: wolfv |
Date: Friday, October 26, 2007
|
Thank you Dan. The attached code worked.
<CFOUTPUT>
<CFLOOP> query="q_1">
<CFSET rowNumber=#currentRow#>
<CFLOOP> query="q_2">
ID1=#q_1.id[rowNumber]#:
ID2=>#q_2.id#,
</CFLOOP>
<br />
</CFLOOP>
<CFOUTPUT>
Next Message: CFFILE action=upload seeing application/pdf file as typetext/html
Blogs related to output in nested cfloop
Certified ColdFusion Developer 5
The outside loop initializes to 1, followed by the inside loop initializing to 7; then the
output is displayed. The first
cfloop> causes the inside, or
nested, loop to increment to 8, and the
output is displayed.
...