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! ==



>Hey Nick - Systable was just a reference to a system table in the
>database you have - it could be anything and you have to check with your
>database administrator what are the tables in which the database has
>stored this information [like if its oracle or db2 or SQL Server - the
>name of this systable ( a placement holder name)  would be different for
>all]
>
>Did you try - ListLen(ValueList(queryname.columnlist))??
>
>Thanks.
>
>-Sandy Vohra
>
>
>-----Original Message-----
>From: Nick G [mailto:[EMAIL PROTECTED] 
>Sent: Monday, January 08, 2007 1:07 PM
>To: CF-Newbie
>Subject: Re: Counting the number of Fields in a dynamic table
>
>Hi Sandy...thanks again for helping me out. I did not come up with a
>suitable solution for my last question since it wound up to be less than
>efficient. So this is my latest attempt to get this thing done. When I
>try looping through the table using "SYSTABLE" it throws an error:
>"Cannot find the input table or query 'SYSTABLE' error. Also, why can't
>we use columnlist as an array in the following mannor:
>#ArrayLen(queryname.columnlist)#

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:2404
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