StructNew

Description

Returns a new structure.

Category

Structure functions

Syntax

StructNew() 

See also

StructClear, StructDelete, StructFind, StructInsert, StructIsEmpty, StructKeyArray, StructCount, StructUpdate, StructAppend, StructGet, StructSort, StructFindKey, StructClear

Example

<!---- This example shows how to use StructNew. It calls the
CF_ADDEMPLOYEE custom tag, which uses the addemployee.cfm file
to add the employee record to a database. ----->
<html>
<head>
<title>Add New Employees</title>
</head>
<body>
<H1>Add New Employees</H1>
<!--- Establish parameters 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>
  <P>First name is #StructFind(employee, "firstname")#
  <P>Last name is #StructFind(employee, "lastname")#
  <P>EMail is #StructFind(employee, "email")#
  <P>Phone is #StructFind(employee, "phone")#
  <P>Department is #StructFind(employee, "department")#
  </cfoutput>
<!--- Call the custom tag that adds employees --->
 <CF_ADDEMPLOYEE EMPINFO = "#employee#">
</cfif>
...