home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / structcopy.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.5 KB  |  38 lines

  1. <!--- This view-only example illustrates usage
  2.       of StructCopy. --->
  3. <P>This file is similar to addemployee.cfm, which is called
  4. by StructNew, StructClear, and StructDelete. To test this file,
  5. copy the StructCopy function to the appropriate place
  6. in addemployee.cfm.
  7. <P>
  8. To run this snippet
  9. under UNIX, you must add employee ID generation logic.
  10. <!--- 
  11. <cfswitch expression="#ThisTag.ExecutionMode#">
  12.    <cfcase value="start">
  13.       <CFIF StructIsEmpty(attributes.EMPINFO)>
  14.         <CFOUTPUT>Error. No employee data was passed.</cfoutput>
  15.           <CFEXIT METHOD="ExitTag">
  16.         <cfelse>
  17.           <CFSET tempStruct = StructCopy(EMPINFO)>
  18.           <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
  19.             INSERT INTO Employees
  20.                 (FirstName, LastName, Email, Phone, Department)
  21.               VALUES 
  22.                 <CFOUTPUT>
  23.                   (
  24.                     æ#StructFind(attributes.tempStruct, "firstname")#Æ ,
  25.                     æ#StructFind(attributes.tempStruct, "lastname")#Æ ,
  26.                     æ#StructFind(attributes.tempStruct, "email")#Æ ,
  27.                     æ#StructFind(attributes.tempStruct, "phone")#Æ ,
  28.                     æ#StructFind(attributes.tempStruct, "department")#Æ
  29.                    )
  30.                 </cfoutput> 
  31.           </cfquery>
  32.         </cfif>
  33.       <CFOUTPUT><HR>Employee Add Complete
  34.          <P>#StructCount(attributes.tempStruct)# columns added.
  35.            </cfoutput>
  36.    </cfcase>
  37. </cfswitch> --->
  38.