Personally, I use the ValueOrSpace() UDF from http://www.cflib.org. <cfif
Len(variable)> is one I use quite often as well. I use ValueOrSpace() when
say, populating a table from a db query, and Len(variable) when I'm deciding
to do one thing or another with processing (like form processing).

Mike Wallick
* Web Application Developer
* [EMAIL PROTECTED]
* 651.628.5377
* http://www.securecomputing.com/


-----Original Message-----
From: trey [mailto:[EMAIL PROTECTED]] 
Sent: Monday, June 03, 2002 3:08 PM
To: CF-Talk
Subject: if value exists, show it


I simply want to test to see if a variable has a value (eg text has been 
returned from a query) and if so, show it. There seem to be a few options --

<cfif isdefined(#variable#)>
        #variable#
</cfif>

or

<cfif len(#variable#) GT 0>
        #variable#
</cfif>

or

<cfif #variable# IS "">
        #variable#
</cfif>

Is one of these better than the others for dealing with text values? I 
understand that IsDefined should be locked; I assume that is not the case 
for the other two.

TIA,
Trey 



______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.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

Reply via email to