I can't test it right now, for accuracy, but this is what I recall...

#queryname["columnName"][1]#

or

#queryname[columnVar][1]#

Also, you can get the column names by using #queryname.columnList#.

M!ke 

-----Original Message-----
From: Richard White [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 13, 2007 7:57 PM
To: CF-Talk
Subject: Array and query References

Hi,

i have a query in which i dont know what the column names will be.
however i have an array that contains the names of the columns but i am
having difficulties in working out how i can reference the columns with
the array. for example:

if i have an array that has 2 elements:
and i want to have a loop that loops through the array and an inner loop
that loops through the query outputting the query results (using the
array names to reference the columns)

here is an example that i know wont work but i hope will help explain
what i am trying to do:


<cfloop index="i" from="1" to="#arraylen(myArray)#">

  <cfloop index="a" from="1" to="#queryName.recordcount#">

      <cfoutput>#queryName.myArray[i][a]#</cfoutput>

  </cfloop>

</cfloop>


the 'myArray[i]' part of the cfoutput is obviously how i am trying to
reference the name of the column but of course the error would be
element myArray[i] doesnt exist in queryName.

is there a way i can do this to correctly reference the column name
using the array elements?

thanks very much for your help

richard

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:294745
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to