CFLib.org – Common Function Library Project

IsNull(val[, NullIdentifier])

Last updated May 01, 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;
  }
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson