New problem...
The query results are displayed across the page in four columns. When the
spacer is inserted it creates a blank line across all four columns rather
than just in the associated column. Is there a way to insert the spacer only
in the associated column?

DougF
-----------------------------
<cfscript>
numRec = get_location.RecordCount;
numColumns = 4;
numRows = ceiling(get_location.RecordCount / numColumns); // always rounds
up.
col1 = 1;  // default start record number for column 1 of table.
col2 = numRows + 1; // default start record number for column 2 of table.
col3 = (numRows * 2) + 1; // default start record number for column 3 of
table.
col4 = (numRows * 3) + 1; // default start record number for column 4 of
table.
</cfscript>

<cfset firstLetter = "A">

<table>
<cfloop index="i" from="1" to="#numRows#">
<tr>
<td>
<cfif numRec GTE col1>
<cfif Left(get_location.city_name[col1],1) NEQ firstLetter>(SPACER
HERE)<cfset firstLetter = left(get_location.city_name[col1],1)></cfif><a
name="#LCase(REReplace("#get_location.city_name[col1]#","(^[a-zA-Z])[a-zA-Z
]+","\1"))#"></a><A
HREF=""> [col1]#/#LCase(REReplace("#get_location.city_name[col1]#","[[:space:]]","-",
"all"))#-#LCase(REReplace("#get_location.state_name[col1]#","[[:space:]]","-
","all"))#-campgrounds.htm">#get_location.city_name[col1]#</A>&nbsp;(#get_lo
cation.listingIDcount[col1]#)
</cfif>
</td>

<td><cfif numRec GTE col2><cfif Left(get_location.city_name[col2],1) NEQ
firstLetter>(SPACER HERE)<cfset firstLetter =
left(get_location.city_name[col2],1)></cfif><a
name="#LCase(REReplace("#get_location.city_name[col2]#","(^[a-zA-Z])[a-zA-Z
]+","\1"))#"></a><A
HREF=""> [col2]#/#LCase(REReplace("#get_location.city_name[col2]#","[[:space:]]","-",
"all"))#-#LCase(REReplace("#get_location.state_name[col2]#","[[:space:]]","-
","all"))#-campgrounds.htm">#get_location.city_name[col2]#</A>&nbsp;(#get_lo
cation.listingIDcount[col2]#)<cfelse>&nbsp;</cfif></td>

<td><cfif numRec GTE col3><cfif Left(get_location.city_name[col3],1) NEQ
firstLetter>(SPACER HERE)<cfset firstLetter =
left(get_location.city_name[col3],1)></cfif><a
name="#LCase(REReplace("#get_location.city_name[col3]#","(^[a-zA-Z])[a-zA-Z
]+","\1"))#"></a><A
HREF=""> [col3]#/#LCase(REReplace("#get_location.city_name[col3]#","[[:space:]]","-",
"all"))#-#LCase(REReplace("#get_location.state_name[col3]#","[[:space:]]","-
","all"))#-campgrounds.htm">#get_location.city_name[col3]#</A>&nbsp;(#get_lo
cation.listingIDcount[col3]#)<cfelse>&nbsp;</cfif></td>

<td><cfif numRec GTE col4><cfif Left(get_location.city_name[col4],1) NEQ
firstLetter>(SPACER HERE)<cfset firstLetter =
left(get_location.city_name[col4],1)></cfif><a
name="#LCase(REReplace("#get_location.city_name[col4]#","(^[a-zA-Z])[a-zA-Z
]+","\1"))#"></a><A
HREF=""> [col4]#/#LCase(REReplace("#get_location.city_name[col4]#","[[:space:]]","-",
"all"))#-#LCase(REReplace("#get_location.state_name[col4]#","[[:space:]]","-
","all"))#-campgrounds.htm">#get_location.city_name[col4]#</A>&nbsp;(#get_lo
cation.listingIDcount[col4]#)<cfelse>&nbsp;</cfif></td>
</tr>
<!--- NOTE: this cfscript must be placed after the content of the loop! --->
<cfsilent>
<cfscript>
col1 = col1+1; // increment by 1 for column 1 of table
col2 = col2+1; // increment by 1 for column 2 of table
col3 = col3+1; // increment by 1 for column 3 of table
col4 = col4+1;
</cfscript>
</cfsilent>
</cfloop>
</table>

----- Original Message -----
From: "Ian Skinner" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, November 14, 2003 10:48 AM
Subject: RE: separating alpha groups in query results

> <cfset firstLetter = "A">
> <cflloop AlphaList index="String">
>     <cfif Left(string,1) NEQ firstLetter>
>         Output Blank Line
>         <cfset firstLetter = left(string,1)
>     </cfif>
>     <cfoutput>#String#</cfoutput>
> </cfloop>
>
> HTH
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to