Structkeyarray - MACROMEDIA COLDFUSION MX 61-CFML Reference

Cfml reference
Hide thumbs Also See for COLDFUSION MX 61-CFML:
Table of Contents

Advertisement

StructKeyArray

Description
Finds the keys in a ColdFusion structure.
Returns
An array of keys; if structure does not exist, ColdFusion throws an exception.
Category
Structure functions
Function syntax
StructKeyArray(structure)
See also
Structure functions
Parameters
Parameter
structure
Usage
A structure's keys are unordered.
Example
<!--- Shows StructKeyArray function to copy keys from a structure to an array.
Uses StructNew to create structure and fills its fields with the
information the user enters in the form fields. --->
<h3>StructKeyArray Example</h3>
<h3>Extracting the Keys from the Employee Structure</h3>
<!-- Create structure. Check whether Submit was pressed. If so, define fields
in employee structure with user entries on form. ----->
<cfset employee = StructNew()>
<cfif Isdefined("Form.Submit")>
<cfif Form.Submit is "OK">
<cfset employee.firstname = FORM.firstname>
<cfset employee.lastname = FORM.lastname>
<cfset employee.email = FORM.email>
<cfset employee.phone = FORM.phone>
<cfset employee.company = FORM.company>
<cfelseIf Form.Submit is "Clear">
<cfset rc = StructClear(employee)>
</cfif>
</cfif>
<p> This example uses the StructNew function to create a structure called
"employee" that supplies employee info. Its fields are filled by
the form. After you enter employee information in structure, the
example uses StructKeyArray function to copy all of the keys from
the structure into an array. </p>
<hr size = "2" color = "#0000A0">
<form action = "structkeyarray.cfm">
<table cellspacing = "2" cellpadding = "2" border = "0">
<tr>
<td>First Name:</td>
<td><input name = "firstname" type = "text"
708
Chapter 3: ColdFusion Functions
Description
Structure from which to extract a list of keys

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents