Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with CFOUTPUTing into a table...

Status
Not open for further replies.

oompa

Programmer
Joined
Nov 29, 2001
Messages
2
Location
US
I am outputing the results of a query--
<cfquery datasource=&quot;578.fbi&quot; name=&quot;events&quot;>
SELECT eventID, day, month, year, title, body
FROM event
WHERE month = #CurrentMonth# AND year = #CurrentYear# ORDER BY day ASC
</cfquery>

into a table--
<table border=1>
<tr>
<cfoutput query=&quot;events&quot; group=&quot;day&quot;>
<td valign=&quot;top&quot;>#day#
<ul>
<cfoutput>
<p><li>#title#
</cfoutput>
</ul>
</td>
</cfoutput>
</tr>
</table>

I need the cells to run horizontally and start a new row after 5 cells. The desired effect is a calendar layout. Note-One day can have many events, hence the group.

I have tried a few ideas, including the possibility of using a distinct row count on Day column and using conditional statements to include more than one cfoutput with startrows and maxrows. However I could not get a distinct record count due to error--Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that does not include the specified expression 'day' as part of an aggregate function.

I am running out of ideas. Any help would be appreciated.

 
<CFSET month=&quot;#DatePart('m', Now())#&quot;>
<CFSET year=&quot;#DatePart('yyyy', Now())#&quot;>
<CFSET CurrentMonthYear=CreateDate(year, month, '1')>
<CFSET Days=DaysInMonth(CurrentMonthYear)>
<CFSET CurrentDay=0>
<CFOUTPUT><!--- change this to a cfoutput query --->
<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2>
<CFLOOP CONDITION=&quot;CurrentDay LTE Days&quot;>
<TR>
<CFLOOP FROM=&quot;1&quot; TO=&quot;7&quot; INDEX=&quot;LoopDay&quot;>
<CFIF CurrentDay IS 0>
<CFIF DayOfWeek(CurrentMonthYear) IS LoopDay>
<CFSET CurrentDay=1>
</CFIF>
</CFIF>
<CFIF (CurrentDay IS NOT 0) AND (CurrentDay LTE Days)>
<TD><!--- put whatever variables you want output here --->#CurrentDay#</TD>
<CFSET CurrentDay=CurrentDay + 1>
<CFELSE>
<TD >&nbsp</TD>
</CFIF>
</CFLOOP>
</TR>
</CFLOOP>
</CFOUTPUT>
</TABLE>
 
Thank you very much. That gives me a nice little calendar table.

Now, would it be too much to ask you how i can get my events which are stored in an Access Db to appear in the calendar under the proper date in a one to many relationship(one day may have many events)?

I am trying to stretch my CF knowledge to unfamiliar territory and am getting my butt kicked. :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top