I've tried doing that, but it gives me an error. I'm guessing because I 
can't use the month() function to convert the myDate column to just output 
the month instead of the whole date. Is there another way to group it by 
month? 

I tried grouping it by myDate, but it ends up stripping out repetitive 
dates. That's a problem because a course can have the dates, but be held 
in different locations. Thanks alot for the reply :)


The value specified for the group attribute 'month('myDate')' does not 
specify a column name of the query. 
 

The error occurred in 
E:\InetPub\wwwroot\Internet\ABSQE(Portuguese)\courses\trainingCalendarTEST2.cfm:
 
line 157
155 :              <table>
156 :                                                            <tr>
157 :  <cfoutput group="'month('myDate')'"><td valign="top" 
bgcolor="eeeeee"><p>#DateFormat(qeCoursesA.myDate, 'dd')#<cfif 
#dateformat(dateadd("d", qeCoursesA.Days-1, qeCoursesA.myDate), "dd")# EQ 
#dateformat(qeCoursesA.myDate, "dd")#><cfelse>-#dateformat(dateadd("d", 
qeCoursesA.Days-1, qeCoursesA.myDate), "dd")#</cfif> - 
#qeCoursesA.Location#<br></p></td></cfoutput>
158 :                                                            </tr>
159 :                                             </table>



Lan Mai
Web and E-Marketing Assistant
ABS Consulting, Inc.
16855 Northchase Drive
Houston, TX 77060
Dir: 281-673-2928
Main: 281-673-2990
FAX: 281-673-2931



"William Seiter" <[EMAIL PROTECTED]> 
02/25/2008 02:05 PM
Please respond to
[email protected]


To
CF-Newbie <[email protected]>
cc

Subject
RE: nested query output






You can use multiple nested cfouput group="" commands that will allow you 
to
group by id and then group by month.

-- 
William E. Seiter
 
Have you ever read a book that changed your life?
Go to: www.winninginthemargins.com
Enter passkey: goldengrove
 
Web Developer / ColdFusion Programmer
http://William.Seiter.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 25, 2008 11:24 AM
To: CF-Newbie
Subject: nested query output

Hi,

I'm sure my problem isn't  a hard one, but I'm somewhat new to CF and any 
help would be certainly useful. I'm creating a dynamic six-month calendar 
for a course schedule. It displays the id, name, day range, and location 
of each course, which pulls from the this query:

SELECT QEBrazilCourses.id, QEBrazilCourses.myName, QEBrazilCourses.Hours, 
QEBrazilCourses.Days, QEBrazilCourses.Weblink, QEBrazilDates.id, 
QEBrazilDates.myDate, QEBrazilDates.Location
FROM QEBrazilCourses, QEBrazilDates
WHERE (QEBrazilCourses.id = QEBrazilDates.id) 
AND (month(QEBrazildates.myDate) BETWEEN month(now()) AND month(now()) + 
5)
ORDER BY #sortBy#, myDate ASC


It outputs as follows:

<cfoutput query="qeCoursesA" group="id">
<p><a href = "#qeCoursesA.Weblink#">#qeCoursesA.id# - 
#qeCoursesA.myName#</a></p> <!---Outputs course id, name, and links them 
to the appropriate file--->
<table>
        <tr>
        <td valign="top" bgcolor="eeeeee"><!---Outputs the day range and 
location of each course--->
                <p><cfoutput>#DateFormat(qeCoursesA.myDate, 'dd')#<cfif 
#dateformat(dateadd("d", qeCoursesA.Days-1, qeCoursesA.myDate), "dd")# EQ 
#dateformat(qeCoursesA.myDate, "dd")#><cfelse>-#dateformat(dateadd("d", 
qeCoursesA.Days-1, qeCoursesA.myDate), "dd")#</cfif> - 
#qeCoursesA.Location#<br></cfoutput></p>
        </td>
        </tr>
</table>
 </cfoutput>

So far, my day range and location is correctly displayed under each 
course. This is how it looks right now:


February
March
April
Course ID/Course Name
15-20 Houston
25-29 Houston
1-5 New Orleans
10-12 San Diego
10-15 Washington, D.C.
6-9 Orlando, FL




However, I need to go one more step beyond that and group those dates by 
month, but I'm not sure how to do it. This is how it should look:


February
March
April
Course ID/Course Name
15-20 Houston
25-29 Houston
1-5 New Orleans
10-12 San Diego
10-15 Washington, D.C.
6-9 Orlando, FL

I tried doing a separate query until I found out you can't nest cfoutput 
tags. Then,  I tried doing a cfloop inside a cfoutput, but it didn't seem 
to work correctly. Can someone give me a tip on solving this?

Thanks very much,
Lan Mai






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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-Newbie/message.cfm/messageid:3349
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to