The tutorials use the currentRow variable to determine where to end the
current row and create the new row. When you're grouping, you (as you
realize) can't use the currentRow var since it's not going to be
incremental anymore. What you'd need to do is initialize a variable to
0, and manually increment it for each iteration of the <cfoutput>. Use
that var MOD 2 as opposed to currentRow MOD 2 and you should be fine.
Something like:
<cfset variables.newrow = false />
<cfoutput query="foo" group="bar">
<table border="1">
<tr>
<cfset variables.endrow = 0 />
<cfoutput>
<cfset variables.endrow = variables.endrow + 1 />
<cfif variables.newrow = true>
<tr>
</cfif>
<td>#foo.data#</td>
<cfif NOT variables.endrow MOD 2>
</tr>
<cfset variables.newrow = true>
<cfelse>
<cfset variables.newrow = false>
</cfif>
</cfoutput>
</tr>
</table>
</cfoutput>
The above code uses the variables.endrow variable in place of where you
would 'normally' use queryname.currentrow in 'non-grouped' output.
Hope that helps (or at the very least, doesn't confuse the issue worse)
:)
Charlie
-----Original Message-----
From: Jillian Carroll [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 04, 2004 11:10 AM
To: CF-Talk
Subject: RE: Displaying Results in Columns
Charlie,
Thank you for the links... but I'm still stuck. I understand completely
how to sort the results into columns --except that I've got a cfoutput
group going on in my results. I can't figure out how to look at the
results 'as a whole'.
Any tips? Something simple I'm just not seeing?
--
Jillian
-----Original Message-----
From: Charlie Griefer [mailto:[EMAIL PROTECTED]
Sent: July 4, 2004 11:06 AM
To: CF-Talk
Subject: RE: Displaying Results in Columns
http://tutorial140.easycfm.com/
http://tutorial141.easycfm.com/
Either of those should help (the second one goes a bit further towards
maintaining 'proper' HTML) :)
-----Original Message-----
From: Jillian Carroll [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 04, 2004 9:35 AM
To: CF-Talk
Subject: Displaying Results in Columns
I'm hoping somebody out there can help. I need to display these results
in two columns (currently just displaying in one).
<cfquery name="search" datasource="#DSN#" username="#db_username#"
password="#db_password#"> SELECT * FROM users WHERE dealership =
#form.dealership# ORDER BY department </cfquery>
<cfoutput query="search" group="department">
#department#
<br /><br />
<cfoutput>
#first_name#<br />
</cfoutput>
<br />
</cfoutput>
Thanks!
--
Jillian
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

