If the variable is always defined, but may not have a value then use:

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

NOTE:
1) you do not need to use "##" around the variable name in the CFIF tag
2) you do not need "GT 0" (instead do a boolean check - if variable has a length it 
will be
true...if not it will be false and not display)

If the variable may not be defined use.....

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

HTH


Bryan Stevenson
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

---------------------------------------------------------
Macromedia Associate Partner
www.macromedia.com
---------------------------------------------------------
Vancouver Island ColdFusion Users Group
Founder & Director
www.cfug-vancouverisland.com

----- Original Message -----
From: "trey" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 1:08 PM
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
>
>
> 
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
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