> Looks cleaner, but isn't it slower?
>
> >
> > Any opionions on:
> >
> > <CFSET QueryResults = IIF(myQuery.RecordCount EQ 0, DE("False"),
> > DE("True"))>
> >

IIF is supposed to be a little inefficient, but its like all these things.
Its probably take a couple of milliseconds longer, so it really makes no
difference.

I'm not sure I agree with the "looks cleaner" comment though. Sure, its on
one line, but its not the easiest thing to read.  I use IIF a reasonable
amount, but given the choice. I'd go with cfscript instead....

To be honest, in Stephen's simple case, you don't need the logic to set
QueryResults to true or false, you can just do this.....

<cfif myQuery.RecordCount>
<!--- Got some records --->

<cfelse>
<!--- Got no records --->

</cfif>

CF will take anything that is greater than 0 to be TRUE and 0 to be FALSE.
(Haven't checked what happens with negative numbers in a while, so couldn't
possibly comment)

A word of warning about this though....  You'd be better using
myQuery.RecordCount GT 0, as I'm not sure that CFMX will take
myQuery.RecordCount as a BOOLEAN when it is greater than 1.

Regards

Stephen


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to