This is coming from an Access Database. For the page I' working on; based on 
the users search criteria, a table (view) will be created with all the relevant 
data. I use the Select * because we have to output the tables entire set of 
information. The setup of my original code is slightly different that what I 
posted before....I tried to simplify incase someone needed to reference it.


>Are you on SQL Server?  If so you can query the sys tables director for
>this.  You *do not* want to be running a select * to get the column
>lists.....a simple select top 1 (pk) from table would be far more
>efficient..
>
>
>
>
>-----Original Message-----
>From: Nick G [mailto:[EMAIL PROTECTED] 
>Sent: 09 January 2007 13:01
>To: CF-Newbie
>Subject: Re: Counting the number of Fields in a dynamic table
>
>Hi Sandy, the ListLen(ValueList(queryname.columnlist)) worked great! And
>just for the sake of some future person who might have the same problems or
>similar needs here is my solution.
>
>The number of columns in my table is dynamic; this will loop through every
>column in my table adding the contents of each field for each record.
>Note...the data in my table is numeric in value and the column names are
>numbers as well.
>
><cfquery name="y" datasource="DB">
>SELECT * From tablename
></cfquery>
>
><cfloop query="y"> 
>
><cfset total=""> 
><cfset counter=0>
>
><cfloop from="1" to="#ListLen(ValueList(y.ColumnList))#" index="i">
>       <cfset total="#Evaluate('y.' & i)#"> 
>       <cfif #total# GT 0>
>       <cfset counter=counter+#tot#>
></cfif>
></cfloop>
><cfoutput>#counter#<br></cfoutput>
></cfloop>
>
>
>== Thanks for your help again Sandy! ==

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2406
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to