<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>LISTLEN</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">LISTLEN</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>
Determines the number of elements in a list. 
</p>

<p>
Integer; the number of elements in a list.
</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>
List 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>ListLen(list [, delimiters ])
</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>
ListAppend, ListDeleteAt, ListInsertAt, ListPrepend; "Lists" in Chapter&#160;3, "Using ColdFusion Variables," 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>
ColdFusion ignores empty list elements; thus, the list &quot;a,b,c,,,d&quot; has four elements.
</p>

<p>
Here are some examples of ListLen processing:
</p>

<p>
</p><div align="left">
<table border="1">
  <caption></caption>
  <tr align="center">    <th>&#160;</th>
    <th>&#160;</th>
    <th>&#160;</th>
</tr>
  <tr align="left">    <td><pre>ListLen(&#39;a,b, c,,,d&#39;)
</pre></td>
    <td>
<p>4</p></td>
    <td>
<p>Third element is &quot; c&quot;</p></td>
</tr>
  <tr align="left">    <td><pre>ListLen(&#39;a,b, c,,,d&#39;,&#39;,&#39;)
</pre></td>
    <td>
<p>4</p></td>
    <td>
<p>Fourth element is &quot;d&#39;&quot;</p></td>
</tr>
  <tr align="left">    <td><pre>ListLen(&#39;elem_1___elem_2___elem_3&#39;)
</pre></td>
    <td>
<p>1</p></td>
    <td>
<p>&#160;</p></td>
</tr>
  <tr align="left">    <td><pre>ListLen(&#39;elem*1***elem*2***elem*3&#39;)
</pre></td>
    <td>
<p>1</p></td>
    <td>
<p>&#160;</p></td>
</tr>
  <tr align="left">    <td><pre>ListLen(&#39;elem_1___elem_2___elem_3&#39;,&#39;_&#39;)
</pre></td>
    <td>
<p>6</p></td>
    <td>
<p>&#160;</p></td>
</tr>
</table>
</div>
<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">Example</span><pre>&lt;h3&gt;ListLen Example&lt;/h3&gt;
&lt;!--- Find a list of users who wrote messages ---&gt;
&lt;cfquery name = &quot;GetMessageUser&quot; datasource = &quot;cfdocexamples&quot;&gt;
   SELECT Username, Subject, Posted
   FROM  Messages
&lt;/cfquery&gt;
&lt;cfset temp = ValueList(GetMessageUser.Username)&gt;
&lt;!--- loop through the list and show it with ListGetAt ---&gt;
&lt;h3&gt;This is a list of usernames who have posted messages
&lt;cfoutput&gt;#ListLen(temp)#&lt;/cfoutput&gt; users.&lt;/h3&gt;
&lt;ul&gt;
&lt;cfloop From = &quot;1&quot; TO = &quot;#ListLen(temp)#&quot; INDEX = &quot;Counter&quot;&gt;
   &lt;cfoutput&gt;&lt;li&gt;Username #Counter#: 
    #ListGetAt(temp, Counter)#&lt;/cfoutput&gt;
&lt;/cfloop&gt;
&lt;/ul&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="LIST">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">LIST</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>A list or a variable that contains one.</p>

  </td>
  </tr>
  </table>
</div>
<div id="DELIMITERS">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DELIMITERS</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>A string or a variable that contains one. Character(s) that separate list elements. The default value is comma. </p>
<p>If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. </p>

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

  </body>
</html>
