Hello Forum,
I am aware of the bug in regards to an inner loop not being able to access the
values in an outer one. It most cases I'd drop a temporary variable right
before the inner loop begins so I can reference it inside.
What I'm doing now is creating a report from a configuration table that may
have additional columns in the future. I run a query from syscolumns to get
the list of columns when the report is ran.
For the output, is there a way to output a column's value based on the position
of the column in the recordset (like an array's index)? The only way I know to
output a value is to say #queryName.columnName#. This leads me to <cfoutput>
over the value query, and <cfloop> over the column query asking for
#evaluate("qValues.#qColumns.name#")# where qColumns.name outputs the column's
name and the evaluate() outputs the value. The code would work fine if it
weren't for CF's nested-loop bug. What happens is the first row's values are
repeated for each record which is not the stored data in the database.
Any ideas how to either drop a temporary row from the qValues query to
reference in the inner loop or access qValues' columns using their ordinal
positions? Below is the code:
<!--- goofs only because of CF bug in nested loops --->
<table border="1" width="100%">
<tr>
<cfoutput query="qColumnNames">
<td>#qColumnNames.name#</td>
</cfoutput>
</tr>
<cfoutput query="qValues">
<tr>
<cfloop query="qColumnNames">
<td>#evaluate("qValues.#qColumnNames.name#")#</td>
</cfloop>
</tr>
</cfoutput>
</table>
Any workarounds appreciated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268993
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4