There is a script here that will do it (set for "alphabetical" sorts, but
would work with numbers with a tweak)  I suppose the column names need
changed too...

http://cfhub.com/discussion/viewmessages.cfm?Forum=11&Topic=183

<!---Pull your recordset--->
<cfquery datasource="Yours" name="GetCats">
select distinct Category
from YourTable
Order By Category ASC
</cfquery>


<!---Set the number of columns you wish--->
<cfset ColumnCount=3>

<!---Determine the number of rows this will require--->
<cfset RowCount=Ceiling(GetCats.RecordCount/ColumnCount)>

<!---Set up the table--->
<table borders=2 rules=all>

<!---Loop once for every "row"--->
<cfloop from=1 to="#RowCount#" index="OuterIndex">
<tr>

<!---Loop once for every "column"--->
<cfloop from=1 to="#ColumnCount#" index="InnerIndex">
<cfset ArrayIndex=OuterIndex+(RowCount*InnerIndex)-RowCount>
<td>

<!---Linit your ArrayIndex to the size of your "Recordset"--->
<cfif ArrayIndex GT GetCats.RecordCount>
non-breaking-space
<cfelse>
<cfoutput>#GetCats.Category[ArrayIndex]#</cfoutput>
</cfif>


</td>
</cfloop>

</tr>
</cfloop>
</table>



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