StructClear

Removes all data from the specified structure. Always returns Yes.

See also StructDelete, StructFind, StructInsert, StructIsEmpty, StructKeyArray, StructCount, StructKeyExists, and StructUpdate.

Syntax

StructClear(structure)
structure

Structure to be cleared.

Example

<!------------------------------------------------------------------ 
This example shows how to use the StructNew, StructInsert and StructClear
functions. It first calls StructInsert to assign values to the
fields in the structure, and then uses StructClear to clear the 
fields. 
--------------------------------------------------------------------->
<HTML>
<HEAD>
<title>Add New Employees</title>
</HEAD>
<BODY>
<H1>Add New Employees</H1>
<!--- Establish parms for first time through  --->
<CFIF NOT IsDefined("FORM.firstname")>
    <CFSET FORM.firstname="">
</CFIF>
<CFIF NOT IsDefined("FORM.lastname")>
    <CFSET FORM.lastname="">
</CFIF>
<CFIF NOT IsDefined("FORM.email")>
    <CFSET FORM.email="">
</CFIF>
<CFIF NOT IsDefined("FORM.phone")>
    <CFSET FORM.phone="">
</CFIF>
<CFIF NOT IsDefined("FORM.department")>
    <CFSET FORM.department="">
</CFIF>

<CFIF FORM.firstname EQ "">
 <P>Please fill out the form.
<CFELSE>
    <CFSET employee=StructNew()>
    <CFSET retCode=StructInsert(employee, "firstname", FORM.firstname)>
    <CFSET retCode=StructInsert(employee, "lastname", FORM.lastname)>
    <CFSET retCode=StructInsert(employee, "email", FORM.email)>
    <CFSET retCode=StructInsert(employee, "phone", FORM.phone)>
    <CFSET retCode=StructInsert(employee, "department", FORM.department)>
<!----------------------------------------------------------------------
        Now clear the structure.
----------------------------------------------------------------------->
    <CFSET retCode=StructClear(employee)>
</CFIF>
...