CFLib.org – Common Function Library Project

IsNull(val[, NullIdentifier])

Last updated May 1, 2002

author

Rob Brooks-Bilson

Version: 1 | Requires: CF5 | Library: DataManipulationLib

Description:
Returns True if the value passed to it represents "NULL". Useful for setting NULLs in the NULL attribute of CFPROCPARAM.

Return Values:
Returns a Boolean.

Example:

<cfparam name="DieSizeX" Default = "">
<cfoutput>
Is DieSizeX NULL: #IsNull(DieSizeX)#
</cfoutput>
<p>
Here's what it would look like in an SP:
<p>
cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" dbvarname="@pack" value="#Attributes.package_type#" maxlength="25" null="#IsNull(Attributes.package_type)#"

Parameters:

Name Description Required
val Value to evaluate for NULL. Yes
NullIdentifier String that represents NULL. Default is an empty string (""). No

Full UDF Source:

/**
 * Returns True if the value passed to it represents &quot;NULL&quot;.
 * 
 * @param val 	 Value to evaluate for NULL. (Required)
 * @param NullIdentifier 	 String that represents NULL.  Default is an empty string (""). (Optional)
 * @return Returns a Boolean. 
 * @author Rob Brooks-Bilson (rbils@amkor.com) 
 * @version 1, May 1, 2002 
 */
function IsNull(val){
  var NullIdentifier = "";
  if (ArrayLen(Arguments) gte 2) 
    NullIdentifier = Arguments[2];
  if (val is NullIdentifier) {
    return True;
  }
  else {
    return False;
  }
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson