Here's another coding "tip" from months ago. Its like they are trying to say
something useful but then don't know how. I figured out what they are trying
to say but the people who would benefit from this advice could not possibly
get something useful out it. Really makes me wonder about them.

---
Coding Tip

Discover methods used by HostMySite's CFMX gurus to address your common
coding and performance issues. Stop by the Developers' Forum to discuss with
fellow ColdFusion users!

CFLoop

When you have a predefined number of groups in a database and you want to
populate all the records segregated by groups, it is a good practice to use
CFLoop rather than multiple SQL statements. By doing so, it allows the query
to run through a number of groups quickly. Of course, we all know CFLoop can
be quite dangerous if not utilized or closed properly, which is one of the
reasons why we implemented the new self-healing rules.

An example of looping through a structure:

<!--- Creating the structure and loop through its contents --->

<CFSET Example=StructNew()>
<CFSET val=StructInsert(Example, "Test1 ", "Category1 ")>
<CFSET val=StructInsert(Example, "Test2 ", "Category2 ")>
<CFSET val=StructInsert(Example, "Test3 ", "Category3 ")>

<!--- Building the table to display contents --->

<cfoutput>
     <table cellpadding="2" cellspacing="2">
         <tr>
              <td><strong><Test></strong></td>
              <td><strong><Category></strong></td>
         </tr>

     <cfloop collection=#example# item="Testdata">
          <tr>
               <td><#person#></td>
               <td><#StructFind(Example, Testdata)#></td>
          </tr>
     </cfloop>

     </table>
</cfoutput>

A recent test comparing the use of multiple SQL statements against utilizing
CFLoop showed the latter method result in less memory usage on the server
and a much quicker average response time. Read more about all of the
attributes of CFLoop at http://livedocs.macromedia.com.
---


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262706
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to