House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

What's wrong with my <cfoutput group>?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Will Tomlinson
12/01/2008 09:48 PM

I don't recall ever having a problem with the <cfoutput> group attribute. But I can't figure out why it isn't woring right here. My table looks like this: ID       Date      ZIP code --------------------------------- 1       12/01/2008    27403 2       12/01/2008    90210 3       12/01/2008    45789 4       12/01/2008    27403 5       12/02/2008    55555 6       12/02/2008    21454 A simple query: <cfquery name="getshipcalclog" datasource="#APPLICATION.settings.dsn#"> SELECT estshiplogid, estshiplogdate, estshippostalcode FROM tblestshiplog ORDER BY estshiplogdate DESC </cfquery> Now, I just want to output the records grouped by the date. So there should be a date heading, and all the zip codes with records on  that date. <cfoutput query="getshipcalclog" group="estshiplogdate"> <h3>#estshiplogdate#</h3>   <cfoutput>   <p>#estshippostalcode#</p>   </cfoutput> </cfoutput> But it outputs every occurence of 12/01/2008 and its zip. When it should display 12/01/2008 as a heading, then fours zips below it. Then start another heading 12/02/2008, and two zips below that. What am I doin wrong here? Thanks! Will

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Will Tomlinson
12/01/2008 10:00 PM

Crap, it goes back to my stupid date/time datatype for the field. All the times are different, and CF IS group the data, but they're all different so it output each row. I used Michael's example from my other thread to do this. Seems to work: SELECT estshiplogid,CAST(FLOOR(CAST(estshiplogdate AS float)) AS datetime) AS theDate, estshippostalcode FROM tblestshiplog ORDER BY estshiplogdate DESC Then I just group using theDate. Thanks, Will


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 20, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31