<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>CFNewbie?com - CFOUTPUT</title>
			<link>http://www.cfnewbie.com/cfnewbie/client/index.cfm</link>
			<description>CFNewbie?com</description>
			<language>en-us</language>
			<pubDate>Wed, 08 Sep 2010 13:17:46-0700</pubDate>
			<lastBuildDate>Wed, 08 Aug 2007 22:19:00-0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>tom.barr@gmail.com</managingEditor>
			<webMaster>tom.barr@gmail.com</webMaster>
			
			
			
			
			
			<item>
				<title>CFTIME: How to Make Content Appear and Disappear</title>
				<link>http://www.cfnewbie.com/cfnewbie/client/index.cfm/2007/8/8/CFTIME-How-to-Make-Content-Appear-and-Disappear</link>
				<description>
				
				&lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt; Content on the web often has 
        a shelf life. You may have information that you want up after a certain 
        point in time or you may want it to be gone after a certain time.You may 
        want to have it appear and disappear without having to be editing files 
        or changing out input in some back end system. You will find that you 
        can build a simple system for publishing and removing info with &lt;a href=&quot;http://www.adobe.com/software/coldfusion/&quot; target=&quot;_blank&quot;&gt;ColdFusion&lt;/a&gt;&apos;s 
        &lt;strong&gt;CFIF&lt;/strong&gt; tag and &lt;strong&gt;CreateDateTime()&lt;/strong&gt; and &lt;strong&gt;Now()&lt;/strong&gt; 
        functions.&lt;/font&gt;&lt;/p&gt;

 &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&lt;strong&gt;CFIF&lt;/strong&gt; is one 
        of the most basic and commonly used tags in ColdFusion. We will use it 
        to hide or display content based on comparing a set date to the time that 
        the page is parsed for the visitor. &lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;The &lt;strong&gt;CreateDateTime()&lt;/strong&gt; 
        function takes date and time parameters and creates a ColdFusion date/time 
        object. The format is CreateDateTime(year,month, day, hour, minute, second). 
        An example would be CreateDateTime (2004, 7, 9,19,59, 0) for July 9, 2004 
        at 7:59pm. &lt;/font&gt;&lt;/p&gt;

      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;The &lt;strong&gt;Now()&lt;/strong&gt; 
        function takes no parameters and produces a ColdFusion date/time object 
        for the current date and time including seconds. &lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;Example Code&lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;The components are simple so 
        let&apos;s put it all together. Our first example is content that displays 
        until a future point in time. In this case if the date/time is less than 
        the target date your content will display. This would be usefull if yo 
        had a contest running and wanted to remove the content from your site 
        when the contest was over.&lt;/font&gt;&lt;/p&gt;
      &lt;p&gt; &lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&amp;lt;cfif #now()# lte #CreateDateTime 
        (2004, 7, 9,19,59, 0)#&amp;gt;&lt;br&gt;
        This content is displayed until July 7, 2004 at 7:59pm.&lt;br&gt;

        &amp;lt;/cfif&amp;gt; &lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt; Our next example is content 
        that displays after a future point in time. In this case if the date/time 
        is greater than the target date your content will display. This would 
        be handy if you had an announcement coming up so you could announce it 
        on your web site without having to sit at your computer and trigger the 
        new content.&lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&amp;lt;cfif #now()# gte #CreateDateTime 
        (2004,7,5,10,30, 0)# &amp;gt;&lt;br&gt;
        This content is displayed after July 5, 2004 at 10:30am.&lt;br&gt;
        &amp;lt;/cfif&amp;gt; &lt;/font&gt;&lt;/p&gt;

      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;Our last example is content 
        that displays after a future point in time and ends at a later date. In 
        this case if the date/time is greater than the target date and it was 
        smaller than a second target date, your content will display. This would 
        be handy if you had an announcement coming up so you could announce it 
        on your web site without having to sit at your computer and trigger the 
        new content and it would also remove the announcement at the appropriate 
        time.&lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&amp;lt;cfif #now()# lte #CreateDateTime 
        (2004, 7, 9,19,59, 0)# &lt;br&gt;
        AND #now()# gte #CreateDateTime (2004,5, 2,10,30, 0)# &amp;gt;&lt;br&gt;
        This content is displayed after May 5, 2004 at 10:30am and disappears 
        after July 7, 2004 at 7:59pm .&lt;br&gt;
        &amp;lt;/cfif&amp;gt; &lt;/font&gt;&lt;/p&gt;
      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;Summary&lt;/font&gt;&lt;/p&gt;

      &lt;p&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;ColdFusion makes dealing with 
        times and dates easy with built in functions like CreateDateTime() and 
        Now(). Developers won&apos;t need to be on call for special announcements or 
        the end of a campaign. Test out some examples of your own making and then 
        don&apos;t let the clock and your computer dictate when you are making content 
        appear and disappear.&lt;/font&gt;&lt;/p&gt;
				
				</description>
						
				
				<category>CFIF</category>				
				
				<category>Basics</category>				
				
				<category>CFOUTPUT</category>				
				
				<pubDate>Wed, 08 Aug 2007 22:19:00-0700</pubDate>
				<guid>http://www.cfnewbie.com/cfnewbie/client/index.cfm/2007/8/8/CFTIME-How-to-Make-Content-Appear-and-Disappear</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Grouping Results with CFQUERY and CFOUTPUT</title>
				<link>http://www.cfnewbie.com/cfnewbie/client/index.cfm/2007/8/8/Grouping-Results</link>
				<description>
				
				&lt;strong&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;

Grouping Results                                                           
&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.adobe.com/software/coldfusion/&quot; target=&quot;_blank&quot;&gt;ColdFusion&lt;/a&gt; 
  makes it easy to select data out of a database and display it on a page. As 
  soon as you feel good about your success in crossing the divide from static 
  to dynamic, someone will say &amp;quot;That&apos;s nice, can you group the list by author?&amp;quot;. 
  Whether you are asked to group things by author, make, brand, year or whatever, 
  ColdFusion has you covered with its grouping capabilities.&lt;/p&gt;

&lt;p&gt;To present things in groups, we first rely on SQL to group the data before 
  it is presented to ColdFusion. This is done with a GROUP BY or ORDER BY clause. 
&lt;/p&gt;
&lt;table width=&quot;60%&quot; border=&quot;1&quot; align=&quot;center&quot; cellpadding=&quot;5&quot; cellspacing=&quot;5&quot;&gt;
  &lt;tr bgcolor=&quot;#003399&quot;&gt; 
    &lt;td width=&quot;24%&quot;&gt;&lt;strong&gt;&lt;font color=&quot;#FFFFFF&quot; face=&quot;Arial, Helvetica, sans-serif&quot;&gt;CLAUSE&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;
    &lt;td width=&quot;76%&quot;&gt;&lt;strong&gt;&lt;font color=&quot;#FFFFFF&quot; face=&quot;Arial, Helvetica, sans-serif&quot;&gt;QUERY&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt; 
    &lt;td&gt;GROUP BY&lt;/td&gt;

    &lt;td&gt;SELECT Author, Title, Publisher&lt;br&gt;
      GROUP BY Publisher, Author, Title&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt; 
    &lt;td&gt;ORDER BY&lt;/td&gt;
    &lt;td&gt;SELECT Author, Title, Publisher&lt;br&gt;
      ORDER BY Publisher, Author, Title&lt;/td&gt;

  &lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;ColdFusion will then display grouped data by using nested CFOUTPUT tags. In 
  both cases the outter most CFOUTPUT will indicate the QUERY and each CFOUTPUT 
  that is used to group will use a GROUP parameter except the innermost CFOUTPUT. The code below will group authors by publisher and then group books by author. &lt;/p&gt;
&lt;table width=&quot;80%&quot; border=&quot;1&quot; align=&quot;center&quot; cellpadding=&quot;5&quot; cellspacing=&quot;5&quot;&gt;
  &lt;tr valign=&quot;top&quot; class=&quot;tablerow1&quot;&gt; 
    &lt;td width=&quot;51%&quot; bgcolor=&quot;#003399&quot;&gt;&lt;font color=&quot;#FFFFFF&quot; face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&lt;strong&gt;CODE&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr valign=&quot;top&quot;&gt; 
    &lt;td&gt;&amp;lt;CFOUTPUT Query=&amp;quot;myquery&amp;quot; GROUP=&amp;quot;Publisher&amp;quot;&amp;gt;&lt;br&gt; 
      &amp;nbsp;&amp;nbsp;&amp;lt;p&amp;gt;#Publisher#&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;lt;CFOUTPUT GROUP=&amp;quot;Author&amp;quot;&amp;gt;&lt;br&gt; 
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br&amp;gt;#Author#&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;CFOUTPUT&amp;gt;&lt;br&gt; 
      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br&amp;gt;~&amp;nbsp;#Title#&lt;br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/CFOUTPUT&amp;gt;&lt;br&gt; 
      &amp;nbsp;&amp;nbsp;&amp;lt;/CFOUTPUT&amp;gt;&lt;br&gt; &amp;lt;/p&amp;gt; &lt;br&gt; &amp;lt;/CFOUTPUT&amp;gt;&lt;/td&gt;

  &lt;/tr&gt;
  &lt;tr valign=&quot;top&quot;&gt; 
    &lt;td bgcolor=&quot;#003399&quot;&gt;&lt;strong&gt;&lt;font color=&quot;#FFFFFF&quot; face=&quot;Arial, Helvetica, sans-serif&quot;&gt;OUTPUT&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr valign=&quot;top&quot;&gt; 
    &lt;td&gt;&lt;p&gt;Macromedia Press&lt;br&gt;
        Forta&lt;br&gt;
        ~CF WACK Third Edition&lt;br&gt;

        ~Reality ColdFusion MX&lt;/p&gt;
      &lt;p&gt;Newbie Press&lt;br&gt;
        Barr&lt;br&gt;
        ~Instant Messenger for Dummies&lt;br&gt;
        Gates&lt;br&gt;
        ~Dominating the World with Software Patches&lt;/p&gt;&lt;/td&gt;

  &lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;If you use a GROUP BY clause with a WHERE clause the GROUP BY clause most come 
  after the WHERE clause. Think of this as the SQL engine finding all of the results 
  that match the WHERE statement and then it groups the results. &lt;/p&gt;
&lt;p&gt;If you use a GROUP BY clause with an ORDER BY, use the GROUP BY before the 
  ORDER BY clause. The SQL engine will create the groups and then order the groups, 
  this reduces the amount of ordering that is done by SQL since the number of 
  groups is the same or less than the number of members of the groups.&lt;/p&gt;

&lt;/p&gt;
				
				</description>
						
				
				<category>SQL</category>				
				
				<category>Basics</category>				
				
				<category>CFOUTPUT</category>				
				
				<pubDate>Wed, 08 Aug 2007 22:01:00-0700</pubDate>
				<guid>http://www.cfnewbie.com/cfnewbie/client/index.cfm/2007/8/8/Grouping-Results</guid>
				
			</item>
			
		 	
			</channel></rss>