User Guide

Chapter 2: ColdFusion Functions 525
StructDelete
Removes the specified item from the specified structure.
See also StructClear, StructFind, StructInsert, StructIsEmpty, StructKeyArray,
StructCount, StructKeyArray, and StructUpdate.
Syntax StructDelete(
structure
,
key
[,
indicatenotexisting
])
structure
Structure containing the item to be removed.
key
Item to be removed.
indicatenotexisting
Indicates whether the function returns FALSE if key does not exist. The default is
FALSE, which means that the function returns Yes regardless of whether key exists.
If you specify TRUE for this parameter, the function returns Yes if key exists and No
if it does not.
Example <!--- This example shows how to use the StructDelete function. --->
<HTML>
<HEAD>
<TITLE>StructDelete Function</TITLE>
</HEAD>
<basefont face="Arial, Helvetica" size=2>
<body bgcolor="#FFFFD5">
<H3>StructDelete Function</H3>
<P>
This example uses the StructInsert and StructDelete functions.
<!--- Establish parms for first time through --->
<CFPARAM NAME="firstname" DEFAULT="Mary">
<CFPARAM NAME="lastname" DEFAULT="Torvath">
<CFPARAM NAME="email" DEFAULT="mtorvath@allaire.com">
<CFPARAM NAME="phone" DEFAULT="777-777-7777">
<CFPARAM NAME="department" DEFAULT="Documentation">
<CFIF IsDefined("FORM.Delete")>
<CFOUTPUT>
Field to be deleted: #form.field#
</CFOUTPUT>
<P>
<CFScript>
employee=StructNew();
StructInsert(employee, "firstname", firstname);
StructInsert(employee, "lastname", lastname);
StructInsert(employee, "email", email);
StructInsert(employee, "phone", phone);
StructInsert(employee, "department", department);