StructCount

Description

Counts the keys in a structure.

Return value

A number; if structure does not exist, throws an exception.

Category

Structure functions

See also

Structure functions

Syntax

StructCount(structure)

History

New in ColdFusion MX: this function can be used on XML objects.

Parameters

Parameter Description
structure
Structure to access

Example

<!--- This view-only example shows use of StructCount. --->
<p>This file is similar to addemployee.cfm, which is called by 
StructNew, StructClear, and StructDelete. To test, copy 
StructCount function to appropriate place in addemployee.cfm.
<!--- 
<cfswitch expression = "#ThisTag.ExecutionMode#">
  <cfcase value = "start">
   <cfif StructIsEmpty(attributes.EMPINFO)>
    <cfoutput>Error. No employee data was passed.</cfoutput>
     <cfexit method = "ExitTag">
   <cfelse>
    <cfquery name = "AddEmployee" datasource = "cfsnippets">
     INSERT INTO Employees
       (FirstName, LastName, Email, Phone, Department)
      VALUES 
       <cfoutput>
        (
         '#StructFind(attributes.EMPINFO, "firstname")#' ,
         '#StructFind(attributes.EMPINFO, "lastname")#' ,
         '#StructFind(attributes.EMPINFO, "email")#' ,
         '#StructFind(attributes.EMPINFO, "phone")#' ,
         '#StructFind(attributes.EMPINFO, "department")#'
         )
       </cfoutput> 
     </cfquery>
   </cfif>
   <cfoutput><hr>Employee Add Complete
     <p>#StructCount(attributes.EMPINFO)# columns added.</cfoutput>
  </cfcase>
</cfswitch> --->

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt290.htm