![MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference Download Page 555](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-cfml-language/coldfusion-4-5-cfml-language_reference_3287257555.webp)
Chapter 2: ColdFusion Functions
531
StructKeyArray
Returns an array of the keys in the specified ColdFusion structure.
See also
StructClear
,
StructDelete
,
StructFind
,
StructInsert
,
StructIsEmpty
,
StructKeyList
,
StructKeyExists
,
StructCount
, and
StructUpdate
.
Syntax
StructKeyArray
(
structure)
structure
Structure from which the list of keys is to be extracted.
Usage
The array of keys returned by StructKeyArray is not in any particular order. In order to
sort keys alphabetically or numerically, use
ArraySort
.
Note that this function throws an exception if structure does not exist.
Example
<!--- This example shows how to use the StructKeyArray
function to copy the keys from a specified structure to an array.
It also uses the StructNew function to create the structure
and fills its fields with the information the user types
into the corresponding form fields. --->
<HTML>
<HEAD>
<TITLE>StructKeyArray Function</TITLE>
</HEAD>
<basefont face="Arial, Helvetica" size=2>
<body bgcolor="#FFFFD5">
<H3>StructKeyArray Example</H3>
<H3>Extracting the Keys from the Employee Structure</H3>
<!----------------------------------------------------------------
This section of code creates the new structure and checks to
see if the submit button has been pressed. If it has been
pressed, the code defines fields in the employee structure
with what the user has entered from the 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)>
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...