<CFIF expression> is the same as <CFIF expression IS TRUE>.

TRUE = yes = !0
FALSE = no = 0

So <CFIF query.RecordCount> is testing that there is not 0 records (in other
words, records were retrieved and the query is not empty).

<CFIF len(query.date)> is testing that Len() does not return 0 (in other
words, the column is not empty).

<CFIF> will never really test for existence unless you use IsDefined() or
ParameterExists().

--- Ben


-----Original Message-----
From: Jon Hall [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 7:40 PM
To: CF-Talk
Subject: cfif shorthand


I'm working on some code that uses a shorthand (I guess...) cfif style quite
a bit. I have tried to stay away from doing this since it makes the code
harder to read, so I never really took the time to figure it out.

For instance...
<cfif query.recordCount>
Is this testing for the existence of the query or if it is greater than
zero?

<cfif len(query.date)>
This particular one has me scratching my head, it never seems to test
negative in the code, but what is it testing for?

Could someone please fill me in here...

jon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
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

Reply via email to