StructIsEmpty

Description

Indicates whether a structure contains data. Returns TRUE if structure is empty.

Category

Structure functions

Syntax

StructIsEmpty(structure) 

See also

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

Parameters

Parameter
Description
structure
Structure to test

Usage

This function throws an exception if structure does not exist.

Example

<!--- This example illustrates usage of StructIsEmpty. --->
<P>This file is identical to addemployee.cfm, which is called by
StructNew, StructClear, and StructDelete. It adds employees.
Employee information is passed through the employee structure
(EMPINFO attribute). In UNIX, you must also add the Emp_ID.
<cfswitch expression = "#ThisTag.ExecutionMode#">
  <cfcase value = "start">
   <cfif StructIsEmpty(attributes.EMPINFO)>
    <cfoutput>Error. No employee data was passed.</cfoutput>
     <cfexit method = "ExitTag">
   <cfelse>
    <!--- Add the employee --->
    <!--- In UNIX, you must also add the Emp_ID --->
     <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</cfoutput>
  </cfcase>
</cfswitch> 

LiveDocs comments are not longer enabled for ColdFusion 5.0. Please use one of the following resources instead.

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

Version 5.0