<cfloop query="stats">
<cfloop list="#Stats.ColumnList#" index="currentColumn">
#stats[currentColumn][currentrow]#
</cfloop>
</cfloop>
> -----Original Message-----
> From: Antony Sideropoulos [mailto:[EMAIL PROTECTED]
> Sent: Friday, 4 April 2003 2:12 p.m.
> To: CF-Talk
> Subject: Referring to 'unknown' query columns
>
> Hello
>
> BACKGROUND:
>
> I have designed a 'Transform' query as part of an intranet usage reporting
> tool. I display the user, the total number of hits, and then the hits per
> page. When someone runs this report, they have the option to limit the
> pages reported on - ie only the general pages, only the admin pages...
>
> Therefore, the query will have a different number of columns, and
> different
> column headings.
>
> If I CFDUMP the query, the results display correctly, but I don't have any
> control over layout.
>
> Therefore, what I want to do is output the data myself.
>
> THE PROBLEM:
>
> How do I programatically output query data, using the values in
> query.ColumnList?
>
> I have done a search in the archives, and found this example which I have
> been unable to get to work:
>
> <cfloop list="#Stats.ColumnList#" index="Cols">
> <cfset currentColumn = Evaluate("Stats" & Cols)>
> #currentColumn #
> </cfloop>
>
> (where Stats is my query name)
>
> I get an error like this:
>
> An error occurred while evaluating the expression:
>
> currentColumn = Evaluate("Stats." & Cols)
>
> Now, it could be that the error arises when the column name includes
> spaces
> (eg Budget Report).
>
> Can someone give me some tips about this before I go back and take all the
> spaces out of the existing data and modify my hit-recording code?
>
> Is there a way to refer to a column by a number? eg Stats.[1]?
>
> If you can make any sense out of the above and can advise me I would be
> most
> grateful.
>
> (I'm using CF5.0)
>
> Thanks
>
> Antony
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4