StructCount

Description

Returns the number of keys in a structure.

Category

Structure functions

See also

StructClear, StructFind, StructInsert, StructIsEmpty, StructKeyArray, StructKeyExists, StructKeyList, StructCount, StructNew, StructUpdate, StructAppend, StructGet, StructSort, StructFindKey, StructClear

Syntax


StructCount(structure) 

Parameters

Parameter
Description
structure
Structure to access

Usage

This function throws an exception if structure does not exist.

Example

<!--- This view-only example illustrates usage of StructCount. --->

<P>This file is similar to addemployee.cfm, which is called by

StructNew, StructClear, and StructDelete. To test this file, copy the

StructCount function to the 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> --->



Banner.Novgorod.Ru