Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check for a variable value that can have null values too ... 1

Status
Not open for further replies.

msng

Programmer
Oct 14, 2003
27
0
0
US
I have defined as follows:

<cfparam name="URL.cust_name_hold" default="">

Later on, if I have to check if URL.cust_name_hold has a value or not, how will I write the IF statement?

Please let me know. Thanks.
 
you can do
Code:
<cfif Len(URL.cust_name_hold)>
variable has a value
<cfelse>
variable is empty
</cfif>


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
Code:
<cfif URL.cust_name_hold is not "">

or.. and this is the preferred, faster method:

Code:
<cfif len(URL.cust_name_hold)>

If you want to make sure the value is not just spaces.. like " " or " "

Code:
<cfif len(trim(URL.cust_name_hold))>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Heh north... same time..

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
all:

Thanks for your solutions. It worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top