User Guide
522 CFML Language Reference
StructClear
Removes all data from the specified structure. Always returns Yes.
See also StructDelete, StructFind, StructInsert, StructIsEmpty, StructKeyArray,
StructCount, StructKeyArray, and StructUpdate.
Syntax StructClear(
structure
)
structure
Structure to be cleared.
Example <!--- This example shows how to use the StructClear
function. It calls the CF_ADDEMPLOYEE custom tag,
which uses the addemployee.cfm file. --->
<HTML>
<HEAD>
<TITLE>Add New Employees</TITLE>
</HEAD>
<BODY>
<H1>Add New Employees</H1>
<!--- Establish parms for first time through --->
<CFPARAM NAME="FORM.firstname" DEFAULT="">
<CFPARAM NAME="FORM.lastname" DEFAULT="">
<CFPARAM NAME="FORM.email" DEFAULT="">
<CFPARAM NAME="FORM.phone" DEFAULT="">
<CFPARAM NAME="FORM.department" DEFAULT="">
<CFIF FORM.firstname EQ "">
<P>Please fill out the form.
<CFELSE>
<CFOUTPUT>
<CFScript>
employee=StructNew();
StructInsert(employee, "firstname", FORM.firstname);
StructInsert(employee, "lastname", FORM.lastname);
StructInsert(employee, "email", FORM.email);
StructInsert(employee, "phone", FORM.phone);
StructInsert(employee, "department", FORM.department);
</CFScript>
</CFOUTPUT>
<!--- Call the custom tag that adds employees --->
<CF_ADDEMPLOYEE EMPINFO="#employee#">
<CFScript>StructClear(employee);</CFScript>
</CFIF>
...