forgive me for not modifying this to show you only exactly what you
need, but the following will show you pretty much how to get there:
<cfset variables.arResultsHeaders = ListToArray(variables.q.columnlist) />
<cfoutput>
<table align="left"
style="background-color:##fff;" <cfif
variables.numCells lte variables.maxsortable>class="sortable"</cfif>
id="queryResults">
<tr>
<th>
Row
</th>
<cfloop
from="1" to="#arrayLen(variables.arResultsHeaders)#" index="i">
<th>
#variables.arResultsHeaders[i]#
</th>
</cfloop>
</tr>
<cfloop from="1"
to="#variables.q.recordCount#" index="k">
<tr>
<th>
#NumberFormat(k,"0000")#
</th>
<cfloop
from="1" to="#arrayLen(variables.arResultsHeaders)#" index="j">
<td>
#variables.q["#variables.arResultsHeaders[j]#"][k]#
</td>
</cfloop>
</tr>
</cfloop>
</table>
</cfoutput>
where variables.q is the query. The line:
#variables.q["#variables.arResultsHeaders[j]#"][k]# is your money maker.
On 11/2/05, Justin D. Scott <[EMAIL PROTECTED]> wrote:
> Have you tried using de() within your evaluate to get past the icky column
> names?
>
> -Justin
>
> > -----Original Message-----
> > From: Steve Milburn [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, November 02, 2005 2:44 PM
> > To: CF-Talk
> > Subject: RE: Query column index number
> >
> > Yes, I know, and I am using that in one part of the page.
> > Here's the rub.
> > I am being given a spreadsheet that I have no control over.
> > The column
> > headers in the spreadsheet contain periods(for example, a
> > column header
> > might be "5.1.A.1.C"), that when imported to sql server are
> > converted to "#"
> > signs, so it becomes "5#1#A#1#C".
> >
> > I was using something along these lines:
> > <cfloop list="qry.columnList" index="column">
> > <cfset colValue = #evaluate(column)#>
> > ...other stuff here...
> > </cfloop>
> >
> > However, CF does not like trying to evaluate columns that
> > have "#" in them.
> > I have a few other ideas, but I was hoping I could refer to
> > the columns by
> > an index.
> >
> > If I do a CFDump of the query, I get the correct values in
> > the columns, so
> > CF can process the table on some level. But I can't loop
> > through the column
> > names and evaluate them, and by the same token I cant use <cfoutput
> > query="qry">#columnName#</cfoutput>. Beside, I don't even
> > know what the
> > column names will be as they are subject to change.
> >
> > Thanks for your help
> >
> >
> > -----Original Message-----
> > From: Justin D. Scott [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, November 02, 2005 2:26 PM
> > To: CF-Talk
> > Subject: RE: Query column index number
> >
> > > How can I refer to a column in my query by it's
> > > position in the query, or an index number, rather
> > > than the name of the column? For example
> >
> > Each query includes a variable called columnList that you can look at.
> >
> > <cfoutput query="qry">
> > #evaluate("qry." & listGetAt(qry.columnList, 2))#
> > </cfoutput>
> >
> >
> > -Justin
> >
> >
> >
> >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222953
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54