User Guide

StructKeyList 873
StructKeyList
Description
Extracts keys from a ColdFusion structure.
Returns
A list of keys; if structure does not exist, ColdFusion throws an exception.
Category
Structure functions
Function syntax
StructKeyList(structure [, delimiter])
See also
Structure functions; “Modifying a ColdFusion XML object” in Chapter 35, “Using XML and
WDDX,” in ColdFusion MX Developer’s Guide
Parameters
Usage
A structures keys are unordered.
Example
<!--- This example shows how to use StructKeyList to list the keys
in a structure. It uses StructNew function to create structure
and fills it with information user enters in form fields. --->
<!--- This section creates structure and checks whether Submit has been
pressed.
If so, code defines fields in the employee structure with what the
user entered in 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)>
</cfif>
</cfif>
<html>
<head>
<title>StructKeyList Function</title>
</head>
Parameter Description
structure Structure from which to extract a list of keys.
delimiter Optional. Character that separates keys in list. The default value is comma.