Sorry for the basic question, but here goes:

I'm trying to allow the columns in a query output table to be dynamic in
order, depending on the sort selection the user previously made in the
form (in the form field form.sort).  Form.sort has four fields in order,
and they are comma-delimited.  In other words, form.sort will contain
something like "First, Last, City, State".  The sql statement uses
form.sort in order by.

Then, I thought it would be nice if the columns showed up in the order the
user selected.  So on the search results page, I wrote form.sort to a
series of variables that I can hopefully use in the CFOUTPUT, like this:

<cfset sortlist = ListToArray(form.sort)>
<cfset col1value = "GetResults.#sortlist[1]#">
<cfset col2value = "GetResults.#sortlist[2]#">
<cfset col3value = "GetResults.#sortlist[3]#">
<cfset col4value = "GetResults.#sortlist[4]#">

Then I wrote out the table, like this:
<table>
<cfoutput query="GetResults">
<tr>
<td>#variables.col1value#&nbsp;</td>
<td>#variables.col2value#&nbsp;</td>
<td>#variables.col3value#&nbsp;</td>
<td>#variables.col4value#&nbsp;</td>
</tr>
</table>


All I get in the output table though, is "variables.col1value".....etc.  I
can't figure out what I did wrong....any help would be appreciated!



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to