<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>STRUCTKEYLIST</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">STRUCTKEYLIST</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Extracts keys from a ColdFusion structure.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span>
<p>
A list of keys; if structure does not exist, ColdFusion throws an exception.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
Structure functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>StructKeyList(structure [, delimiter])
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
Structure functions; "Modifying a ColdFusion XML object" in Chapter&#160;35, "Using XML and WDDX," in ColdFusion MX Developer's Guide
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
A structure's keys are unordered. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;!--- 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. ---&gt;
&lt;!--- 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. ---&gt;
&lt;cfset employee = StructNew()&gt; 
&lt;cfif Isdefined(&quot;Form.Submit&quot;)&gt;
   &lt;cfif Form.Submit is &quot;OK&quot;&gt;
      &lt;cfset employee.firstname = FORM.firstname&gt;
      &lt;cfset employee.lastname = FORM.lastname&gt;
      &lt;cfset employee.email = FORM.email&gt;
      &lt;cfset employee.phone = FORM.phone&gt;
      &lt;cfset employee.company = FORM.company&gt; 
   &lt;cfelseIf Form.Submit is &quot;Clear&quot;&gt;
      &lt;cfset rc = StructClear(employee)&gt;
   &lt;/cfif&gt;
&lt;/cfif&gt;    
&lt;html&gt;
&lt;head&gt;
   &lt;title&gt;StructKeyList Function&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h3&gt;StructKeyList Function&lt;/h3&gt;
&lt;h3&gt;Listing the Keys in the Employees Structure&lt;/h3&gt;
&lt;p&gt;This example uses StructNew function to create structure &quot;employee&quot; that
supplies employee information. The fields are filled with the 
contents of the following form.&lt;/p&gt;
&lt;p&gt;After you enter employee information into structure, example uses
&lt;b&gt;StructKeyList&lt;/b&gt; function to list keys in structure.&lt;/p&gt;
&lt;p&gt;This code does not show how to insert information into a database. 
See cfquery for more information about database insertion.
&lt;hr size = &quot;2&quot; color = &quot;#0000A0&quot;&gt;
&lt;form action = &quot;structkeylist.cfm&quot;&gt;
&lt;table cellspacing = &quot;2&quot; cellpadding = &quot;2&quot; border = &quot;0&quot;&gt;
   &lt;tr&gt;
   &lt;td&gt;First Name:&lt;/td&gt;
   &lt;td&gt;&lt;input name = &quot;firstname&quot; type = &quot;text&quot; 
      value = &quot;&quot; hspace = &quot;30&quot; maxlength = &quot;30&quot;&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;Last Name:&lt;/td&gt;
   &lt;td&gt;&lt;input name = &quot;lastname&quot; type = &quot;text&quot; 
      value = &quot;&quot; hspace = &quot;30&quot; maxlength = &quot;30&quot;&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;EMail&lt;/td&gt;
   &lt;td&gt;&lt;input name = &quot;email&quot; type = &quot;text&quot; 
      value = &quot;&quot; hspace = &quot;30&quot; maxlength = &quot;30&quot;&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;Phone:&lt;/td&gt;
   &lt;td&gt;&lt;input name = &quot;phone&quot; type = &quot;text&quot; 
      value = &quot;&quot; hspace = &quot;20&quot; maxlength = &quot;20&quot;&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;Company:&lt;/td&gt;
   &lt;td&gt;&lt;input name = &quot;company&quot; type = &quot;text&quot; 
      value = &quot;&quot; hspace = &quot;30&quot; maxlength = &quot;30&quot;&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
   &lt;td&gt;&lt;input type = &quot;submit&quot; name = &quot;submit&quot;       value = &quot;OK&quot;&gt;&lt;/td&gt;
   &lt;td&gt;&lt;b&gt;After you submit form, scroll down       to see the list.&lt;/b&gt;&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;cfif NOT StructISEmpty(employee)&gt; 
   &lt;hr size = &quot;2&quot; color = &quot;#0000A0&quot;&gt; 
   &lt;cfset keysToStruct = StructKeyList(employee,&quot;&lt;li&gt;&quot;)&gt;
   &lt;p&gt;Here are the keys to the structure:&lt;/p&gt; 
   &lt;ul&gt;
   &lt;li&gt;   &lt;cfoutput&gt;#keysToStruct#&lt;/cfoutput&gt;
   &lt;/ul&gt;
   &lt;p&gt;If fields are correct, we can process new employee information. 
If they are not correct, consider rewriting application.&lt;/p&gt;
&lt;/cfif&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="STRUCTURE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">STRUCTURE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>Structure from which to extract a list of keys.</p>

  </td>
  </tr>
  </table>
</div>
<div id="DELIMITER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DELIMITER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>Optional. Character that separates keys in list. The default value is comma.</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
