I really wish that people using my documents (originally posted in issues of FA) put down where they got the information from. I see chunks of information on that page taken directly from me. Now as for IIS() under MX. I've tested it heavily and there is literally no difference speed wise between IIF and CFIF. Counting on the run, you can see the numbers change in the .001 millisecond range which is nothing at all, especially as the numbers change for both and there is no clear pattern. That being said, I declare that the "best practice" of not using IIF() is dead as of MX.
> Using IIF() is slower. > http://www.corfield.org/coldfusion/codingStandards.htm > > At 11:43 AM 7/16/2002 +0100, you wrote: > >********************************************************************** > >WESTMINSTER CITY COUNCIL > >Please refer to the disclaimer beneath this message > >********************************************************************** > > > >Yep it does look a lot cleaner than what I have been doing, but I do have to > >agree with Adrian that it could be slower. I have heard somewhere can't > >remember where. That using IIF() is slower. > > > > > ---------- > > > From: Adrian Lynch[SMTP:[EMAIL PROTECTED]] > > > Sent: 16 July 2002 11:36 > > > To: CF-Talk > > > Subject: RE: Writing efficient CFIF statements > > > > > > Looks cleaner, but isn't it slower? > > > > > > -----Original Message----- > > > From: Hugo Ahlenius [mailto:[EMAIL PROTECTED]] > > > Sent: 16 July 2002 11:31 > > > To: CF-Talk > > > Subject: RE: Writing efficient CFIF statements > > > > > > > > > Any opionions on: > > > > > > <CFSET QueryResults = IIF(myQuery.RecordCount EQ 0, DE("False"), > > > DE("True"))> > > > > > > ? > > > > > > Cheers, Hugo > > > > > > > > > ------------------------------------------------------------- > > > Hugo Ahlenius E-Mail: [EMAIL PROTECTED] > > > Project Officer Phone: +46 8 7410451 > > > UNEP GRID-Arendal Fax: +46 733 403285 > > > Stockholm Office Mobile: +46 733 467111 > > > WWW: http://www.grida.no > > > ------------------------------------------------------------- > > > > > > > > > > > > | -----Original Message----- > > > | From: Tim Painter [mailto:[EMAIL PROTECTED]] > > > | Sent: Tuesday, July 16, 2002 12:19 > > > | To: CF-Talk > > > | Subject: Re: Writing efficient CFIF statements > > > | > > > | > > > | Stephen, > > > | I usually like to set things either "true" or "false". > > > | (or 1 or 0). The true or false is a little more visual, I > > > | think -- so to use your example, I would do it like: > > > | > > > | <cfif myQuery.RecordCount EQ 0> > > > | <cfset QueryResults = false> > > > | <cfelse> > > > | <cfset QueryResults = true> > > > | </cfif> > > > | > > > | <cfif QueryResults> > > > | There are records > > > | <cfelse> > > > | No records to display > > > | </cfif> > > > | > > > | This is reverse of yours (if there are no records, then the > > > | variable is false -- your example shows as true) To me it > > > | made more sense to have that variable false. > > > | > > > | Of course, you can bypass the whole cfif and use the > > > | myQuery.RecordCount and test whether that is true/false: > > > | <cfif myQuery.recordcount> > > > | There are records > > > | <cfelse> > > > | No records to display. > > > | </cfif> > > > | > > > | > > > | > > > | ----- Original Message ----- > > > | From: "Adams, Stephen" <[EMAIL PROTECTED]> > > > | To: "CF-Talk" <[EMAIL PROTECTED]> > > > | Sent: Tuesday, July 16, 2002 5:08 AM > > > | Subject: Writing efficient CFIF statements > > > | > > > | > > > | > > > > | ********************************************************************** > > > | > WESTMINSTER CITY COUNCIL > > > | > Please refer to the disclaimer beneath this message > > > | > > > > | ********************************************************************** > > > | > > > > | > Hi, > > > | > > > > | > I am trying to put more structure into my CF code. My idea > > > | is to separate > > > | > the ColdFusion processing from the HTML structure and use > > > | CSS for the look > > > | > of the site. I am trying to get an idea of what is the > > > | best way to separate > > > | > the CF. I know that I could use custom tags, user defined > > > | function and if I > > > | > was using MX, then components. But these are for code that > > > | can across used > > > | > in multiple pages. What I am talking about is the CF for > > > | an individual > > > | > page. > > > | > > > > | > What has all this to do with CFIF statements, well. I was > > > | thinking of > > > | > setting a series of flags that are checked against in my > > > | HTML. The CFIF > > > | > statements are there to check the value of these flags and > > > | amend the page > > > | > depending on these flags. So I want to be able to write > > > | good efficient CFIF > > > | > statements so that my code is up to speed. > > > | > > > > | > Here's an example of what I am talking about: > > > | > > > > | > <!--- Default ColdFusion Parameters ---> > > > | > <cfparam name="QueryResults" default="" type="string"> > > > | > > > > | > <!--- ColdFusion Processing ---> > > > | > <cfquery name="myQuery" datasource="myDSN"> > > > | > SELECT * > > > | > FROM myTable > > > | > </cfquery> > > > | > > > > | > <!--- Sets flags ---> > > > | > <cfif myQuery.RecordCount EQ 0> > > > | > <cfset QueryResults = 1> > > > | > </cfif> > > > | > > > > | > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> > > > | > > > > | > <html> > > > | > <head> > > > | > <title>Untitled</title> > > > | > </head> > > > | > > > > | > <body> > > > | > > > > | > <cfif QueryResults EQ "1"> > > > | > <table cellspacing="2" cellpadding="2"> > > > | > <tr> > > > | > <td class="mainFont">Results found.</td> > > > | > </tr> > > > | > </table> > > > | > <cfelse> > > > | > <table cellspacing="2" cellpadding="2"> > > > | > <tr> > > > | > <td class="mainFont">No results found.</td> > > > | > </tr> > > > | > </table> > > > | > </cfif> > > > | > </body> > > > | > </html> > > > | > > > > | > This is a simple example, but it shows how I want to keep > > > | the processing > > > | > separate at the top of the page. > > > | > > > > | > My question, finally, is how are CFIF statements best > > > | written if I want to > > > | > code this way and or is there a better way of writing my CF code. > > > | > > > > | > Thanks. > > > | > > > > | > > > > | > > > > | ********************************************************************** > > > | > Westminster City Council switchboard: > > > | > +44 20 7641 6000 > > > | > > > > | ********************************************************************** > > > | > This E-Mail may contain information which is > > > | > privileged, confidential and protected from > > > | > disclosure. If you are not the intended recipient > > > | > of this E-mail or any part of it, please telephone > > > | > Westminster City Council immediately on receipt. > > > | > You should not disclose the contents to any other > > > | > person or take copies. > > > | > > > > | ********************************************************************** > > > | > > > > | > > > > | > > > > > > > > > > > > ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

