CODEFETCH™
            Examples
Searched for 1 expression(s): cfset  
Cold Fusion API
cfset search codefetch
Defines a ColdFusion variable. If the variable exists, this tag sets it to the specified value....
cfsetting search codefetch
Controls aspects of page processing, such as the output of HTML code in pages....
ArraySwap search codefetch
Swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags....
Source code below from:
Advanced Macromedia ColdFusion MX 7 Application Development
By Ben Forta and Sarge Sargent
Published 25 April, 2005
Average rating

      Powells     Alibris

23/notRB.cfm (16 lines)
9  ---> 
10  
11 <cfset loginRB=structNew()>
12 <cfset loginRB.en_US.loginFormTitle="Please login">
13 <cfset loginRB.en_US.userNameLabel="user name">
14 <cfset loginRB.en_US.passwordLabel="password">
15 <cfset loginRB.en_US.loginButton="login">
16 <cfset loginRB.en_US.clearButton="clear">

18/Application.cfc (11 lines)
2  
3 <cfcomponent> 
4   <cfset This.name = "Chapter18">
5    
6   <cffunction name="OnApplicationStart"> 
7     <cfset Application.urlRoot = "/Chapter18">
8     <cfset Application.dbDSN = "Chapter18">
9   </cffunction> 
10 </cfcomponent> 

18/Auth.cfm (54 lines)
26    
27     <!--- Loop over the list of required roles ---> 
28     <cfset inRole = FALSE>
29     <cfloop list="#Attributes.roles#" index="currentRole"> 
30       <cfif IsUserInRole(currentRole)> 
31         <!--- If Attributes.memberOf is "AnyOfTheseRoles", and there is a match, 
32         the user may access content. ---> 
33         <cfset inRole = TRUE>
34         <cfbreak> 
35       </cfif> 

18/Bidirectional/IntelligentInput.cfm (30 lines)
10   <cfassociate basetag="CF_INTELLIGENTFORM"> 
11    
12   <cfset parentData = GetBaseTagData("CF_INTELLIGENTFORM")>
13    
14   <cfdump var="#parentData#"  

18/DisplayField.cfm (54 lines)
14  
15   <!--- Make the parent tag's attributes available to this child tag ---> 
16   <cfset parentData = GetBaseTagData("CF_DISPLAYFORM")>
17    
18   <cfif parentData.Attributes.formStatus EQ "Preparing"> 
Source code below from:
Macromedia ColdFusion MX 7 Web Application Construction Kit (Web Application Construction Kit)
By Ben Forta, Raymond Camden, Leon Chalnick, and Angela C. Buraglia
Published 23 March, 2005
Average rating

      Powells     Alibris

ows/10/details3.cfm (87 lines)
8  
9 <!--- Movie list page ---> 
10 <cfset list_page="movies8.cfm">
11  
12 <!--- Make sure FilmID was passed ---> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32 33 <!--- Build image paths ---> 34 <cfset image_src="../images/f#movie.FilmID#.gif"> 35 <cfset image_path=ExpandPath(image_src)> 36 37 <!--- Create HTML page --->

ows/10/dynamicsql.cfm (23 lines)
7  
8 <!--- Create FilmID variable ---> 
9 <cfset FilmID=1>
10  
11 <!--- Get a movie from database ---> 

ows/10/frame_details.cfm (72 lines)
28  
29 <!--- Build image paths ---> 
30 <cfset image_src="../images/f#movie.FilmID#.gif">
31 <cfset image_path=ExpandPath(image_src)>
32  
33 <!--- Create HTML page ---> 

ows/10/movies7.cfm (42 lines)
28   <!--- What color should this row be? ---> 
29    <cfif CurrentRow MOD 2 IS 1> 
30     <cfset bgcolor="MediumSeaGreen">
31    <cfelse> 
32     <cfset bgcolor="White">
33    </cfif> 
34   <tr bgcolor="#bgcolor#"> 

ows/11/browse.cfm (57 lines)
1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
2 <cfparam name="PageNum_movies" default="1"> 
3 <cfinvoke 
4   component="ows.11.movies" 
5   method="List" 
6   returnvariable="movies"> 
7 </cfinvoke> 
8 <cfset MaxRows_movies=10>
9 <cfset StartRow_movies=Min((PageNum_movies-1)*MaxRows_movies+1,Max(movies.RecordCount,1))>
10 <cfset EndRow_movies=Min(StartRow_movies+MaxRows_movies-1,movies.RecordCount)>
11 <cfset TotalPages_movies=Ceiling(movies.RecordCount/MaxRows_movies)>
12 <cfset QueryString_movies=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
13 <cfset tempPos=ListContainsNoCase(QueryString_movies,"PageNum_movies=","&")>
14 <cfif tempPos NEQ 0> 
15   <cfset QueryString_movies=ListDeleteAt(QueryString_movies,tempPos,"&")>
16 </cfif> 
17  
Source code below from:
ColdFusion Web Development with Macromedia Dreamweaver MX 2004 (Books for Professionals by Professionals)
By Jen deHaan, Peter deHaan, Massimo Foti, Curtis Hermann, Simon Horwith, and Edoardo Zubler
Published 18 April, 2004
Average rating

      Powells     Alibris

ch11/xmldom10.cfm (27 lines)
8   
9  
10 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")>
11  
12  
13   <cfset myXMLDOM = XMLParse(variables.originalXMLString)>
14   
15 <cfscript> 

ch11/xmldom11.cfm (31 lines)
8   
9  
10 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")>
11  
12  
13   <cfset myXMLDOM = XMLParse(variables.originalXMLString)>
14   
15 <cfscript> 

ch11/xmldom12.cfm (29 lines)
8   
9  
10 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")>
11  
12  
13   <cfset myXMLDOM = XMLParse(variables.originalXMLString)>
14   
15 <cfscript> 

ch11/xmldom13.cfm (28 lines)
25 <cffile action="read" variable="myXSL" file="#expandPath('.')#\figsXSL.xsl"> 
26  
27 <cfset transformedXML = XMLTransform(variables.myXMLDOM, variables.myXSL)>
28 <cfoutput>#variables.transformedXML#</cfoutput> 

ch11/xmldom3.cfm (35 lines)
14   </cfcatch> 
15 </cftry> 
16 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")>
17  
18 <cftry> 
19   <cfset myXMLDOM = XMLParse(variables.originalXMLString)>
20   <cfcatch> 
21     <h3>Error parsing XML!</h3> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26 <cfdump var="#myXMLDOM#" label="My XML Packet From File"> 27 28 <cfset newXMLString = toString(variables.myXMLDOM)> 29 <cftry> 30 <cffile action="write" file="#variables.targetXMLFile#" output="#variables.newXMLString#">
Source code below from:
Programming ColdFusion MX, 2nd Edition
By Rob Brooks-Bilson
Published June, 2003
Average rating

      Powells     Alibris

ProgrammingCF/10/10-25.cfm (41 lines)
18   <!--- If the parent is a category, set image to Folder. If it is a link, set the image to Document ---> 
19   <cfif LinkURL is ""> 
20     <cfset Image="Folder">
21   <cfelse> 
22     <cfset Image="Document">
23   </cfif> 
24  

ProgrammingCF/10/recurse.cfm (41 lines)
18   <!--- If the parent is a category, set image to Folder. If it is a link, set the image to Document ---> 
19   <cfif LinkURL is ""> 
20     <cfset Image="Folder">
21   <cfelse> 
22     <cfset Image="Document">
23   </cfif> 
24  

ProgrammingCF/11/11-23.cfm (53 lines)
1 <!--- Set URL.ID=1. Normally, this value would come as a URL parameter or 
2       form post (then it would be form.ID) ---> 
3 <cfset URL.ID = 1>
4  
5 <!--- Retrieve the full record of the employee whose ID is specified. 

ProgrammingCF/11/11-27.cfm (109 lines)
1 <!--- Initialize a variable called Continue to control the transaction ---> 
2 <cfset Continue = true>
3  
4 <!--- Begin transaction ---> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 <cfcatch type="Database"> 22 <cftransaction action="Rollback" /> 23 <cfset ProblemQuery = "MakeSalesDirectory"> 24 <cfset Continue = false> 25 </cfcatch> 26 </cftry>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 <cfcatch type="Database"> 42 <cftransaction action="Rollback" /> 43 <cfset ProblemQuery = "InsertRecord"> 44 <cfset Continue = false> 45 </cfcatch> 46 </cftry>

ProgrammingCF/11/11-3.cfm (32 lines)
7  
8 <!--- Initialize the StartNewRow variable as true ---> 
9 <cfset StartNewRow = true>
10  
11 <h2>Two column output sorted left to right</h2> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22 23 <!--- Set StartNewRow to the opposite of its currnet true/false value ---> 24 <cfset StartNewRow = not(StartNewRow)> 25 26 <!--- If StartNewRow is true, add a /tr to close the row --->
Source code below from:
ColdFusion MX Developer's Cookbook
By Peter Freitag, Brad Leupen, and Chris Reeves
Published 09 April, 2003
Average rating

      Powells     Alibris

ColdFusion MX Developer's Cookbook/chapter01/alphabet.cfm (7 lines)
1 <cfset start = Asc('A')>
2 <cfset end = start + 25>
3 <cfloop from="#start#" to="#end#" index="i"> 
4     <cfset charUpper = Chr(i)>
5     <cfset charLower = Chr(i+32)>
6     <cfoutput>#charUpper# --> #charLower#<br></cfoutput> 
7 </cfloop> 

ColdFusion MX Developer's Cookbook/chapter01/copyright.cfm (2 lines)
1 <cfset string = "Copyright "&Chr(169)&" 2002">
2 <cfoutput>#string#</cfoutput> 

ColdFusion MX Developer's Cookbook/chapter01/encrypt.cfm (8 lines)
1 <cfset theString = "ColdFusion">
2 <!--- I also use "1234" for my luggage combination ---> 
3 <cfset key = "key">
4  
5 <cfset encryptedString = Encrypt(theString,key)>
6 <cfoutput>Encrypted String: "#encryptedString#"</cfoutput><br> 
7 <cfset decryptedString = Decrypt(encryptedString,key)>
8 <cfoutput>Decrypted String: "#decryptedString#"</cfoutput> 

ColdFusion MX Developer's Cookbook/chapter01/hash.cfm (20 lines)
2 <body> 
3     <cfif isdefined("submitted")> 
4         <cfset orig_password = "password">
5         <cfset hashedPw = Hash(orig_password)>
6         <cfset hashedAttempt = Hash(password)>
7         <cfif hashedPw is hashedAttempt> 
8             You entered the correct password. 

ColdFusion MX Developer's Cookbook/chapter01/readFile.cfm (6 lines)
1 <cfset filename = GetDirectoryFromPath(GetCurrentTemplatePath())&"data.txt">
2 <cffile action="read" file="#filename#" variable="data"> 
3  
Source code below from:
Coldfusion MX Developer's Handbook
By Raymond Camden, Arman Danesh, Hal Helms, Guy Rish, Emily Kim, Shlomy Gantz, Jen deHaan, and Peter deHaan
Published 17 January, 2003
Average rating

      Powells     Alibris

editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/applicationextract.cfm (36 lines)
14          <CFIF not isdefined("URL.DebugMode")> 
15             <CFIF isdefined("session.DebugMode")> 
16                <CFSET Request.DebugMode = Session.DebugMode>
17             </CFIF> 
18          <CFELSE> 
19             <!--- they did define it on the URL, so that overrides the session. 
20                We now set it in the session for the next page load. ---> 
21             <CFSET Session.DebugMode = URL.DebugMode>
22             <CFSET Request.DebugMode = URL.DebugMode>
23          </CFIF> 
24       </CFLOCK> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33 <CFIF Request.DebugMode NEQ "0"> 34 <!--- finally, turn on debug output if we are in debug mode ---> 35 <CFSETTING showdebugoutput="yes"> 36 </CFIF>

editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/createUser.cfm (19 lines)
10     Description: Create and Display a User 
11 ---> 
12 <CFSET GetUser = structNew()>
13 <CFSET GetUser.Name = "Ken">
14 <CFSET GetUser.Hobby = "Improvisational Comedy">
15 <CFSET GetUser.EmployeeID = "123123">
16 <CFOUTPUT>Hello, #GetUser.Name#</CFOUTPUT> 
17  

editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/mcMain.cfm (17 lines)
10 ---> 
11  
12 <CFSET MyName = "Ken">
13 <CFOUTPUT>mcMain: Starting.<BR></CFOUTPUT> 
14 <CFINCLUDE TEMPLATE="mcIncluded.cfm"> 

editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/monitoring.cfm (17 lines)
8 <CFLOG application="yes"> 
9 <CFERROR type="monitor" template="monitortemplate.cfm"> 
10 <CFSET stX = structNew()>
11 <CFSET stX.a = "test">
12 <CFSET stX.b = "yo">
13 <CFLOOP collection="#stX#" item="Y"> 
14     <CFOUTPUT>#y#</CFOUTPUT> 

editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/mycfc.cfc (12 lines)
7    <cffunction name="myFunction" access="remote" returntype="string"> 
8       <cfargument name="myArgument" type="string" required="true"> 
9       <cfset myResult="MyCFC Result =" & arguments.myArgument & "<BR>">
10       <cfreturn myResult> 
11    </cffunction> 
Source code below from:
Macromedia ColdFusion MX Development with Dreamweaver MX: Visual QuickPro Guide
By Sue Hove, Marc A. Garrett, and Ben Forta
Published 20 December, 2002
Average rating

      Powells     Alibris

Chapter05/EmpList_Navbar_Page66.cfm (66 lines)
1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
2 <cfparam name="PageNum_q_EmployeeList" default="1"> 
3 <cfquery name="q_EmployeeList" datasource="exampleapps"> 
4 SELECT FirstName, LastName FROM tblEmployees 
5 </cfquery> 
6 <cfset MaxRows_q_EmployeeList=10>
7 <cfset StartRow_q_EmployeeList=Min((PageNum_q_EmployeeList-1)*MaxRows_q_EmployeeList+1,Max(q_EmployeeList.RecordCount,1))>
8 <cfset EndRow_q_EmployeeList=Min(StartRow_q_EmployeeList+MaxRows_q_EmployeeList-1,q_EmployeeList.RecordCount)>
9 <cfset TotalPages_q_EmployeeList=Ceiling(q_EmployeeList.RecordCount/MaxRows_q_EmployeeList)>
10 <cfset QueryString_q_EmployeeList=Iif(CGI.QUERY_STRING NEQ "",DE("&"&CGI.QUERY_STRING),DE(""))>
11 <cfset tempPos=ListContainsNoCase(QueryString_q_EmployeeList,"PageNum_q_EmployeeList=","&")>
12 <cfif tempPos NEQ 0> 
13   <cfset QueryString_q_EmployeeList=ListDeleteAt(QueryString_q_EmployeeList,tempPos,"&")>
14 </cfif> 
15 <html> 

Chapter05/EmpList_Table_Restrict_Page62.cfm (29 lines)
3 SELECT FirstName, LastName FROM tblEmployees  
4 </cfquery> 
5 <cfset MaxRows_q_EmployeeList=10>
6 <cfset StartRow_q_EmployeeList=Min((PageNum_q_EmployeeList-1)*MaxRows_q_EmployeeList+1,Max(q_EmployeeList.RecordCount,1))>
7 <cfset EndRow_q_EmployeeList=Min(StartRow_q_EmployeeList+MaxRows_q_EmployeeList-1,q_EmployeeList.RecordCount)>
8 <cfset TotalPages_q_EmployeeList=Ceiling(q_EmployeeList.RecordCount/MaxRows_q_EmployeeList)>
9 <html> 
10 <head> 

Chapter07/DynamicFormObject_Page93.cfm (157 lines)
1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
2 <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1"> 
3   <cfquery datasource="exampleapps"> 

Chapter07/InsEmpManualwithIns_Page106.cfm (71 lines)
1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
2 <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "Ins_Emp"> 
3   <cfquery datasource="exampleapps"> 

Chapter07/Insert_Emp_Page90.cfm (148 lines)
1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
2 <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1"> 
3   <cfquery datasource="exampleapps"> 
Source code below from:
Discovering CFCs: ColdFusion MX Components
By Hal Helms
Published 09 October, 2002
Average rating

      Powells     Alibris

Office.cfc (29 lines)
1 <cfcomponent hint="I am an Office"> 
2      
3     <cfset this.pricePerLOC = 6.34>
4     <cfset this.name = "DUL - Atlanta"> 
5  
6     <cffunction name="getPricePerLOC"> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
15 <cfargument name="department" type="Department" required="Yes"> 16 <cfparam name="this.departments" default="#ArrayNew( 1 )#"> 17 <cfset ArrayAppend( this.departments, arguments.department )> 18 </cffunction> 19 20 <cffunction name="calculatePayroll"> 21 <cfparam name="this.departments" default="#ArrayNew( 1 )#"> 22 <cfloop 23 from="1" 24 to="#ArrayLen( this.departments )#" 25 index="i"> 26 <cfset this.departments[i].calculatePayroll()> 27 </cfloop> 28 </cffunction>
Source code below from:
Reality ColdFusion: Intranets and Content Management
By Ben Forta
Published 25 September, 2002
Average rating

      Powells     Alibris

ApplicationFiles/ErrorTest.cfm (257 lines)
1 <cfsetting enablecfoutputonly="Yes">
2 <!---------------------------------------------------------------- 
3 Template: .cfm 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
255 </cfoutput> 256 257 <cfsetting enablecfoutputonly="No">

ApplicationFiles/Flash/getDocList.cfm (18 lines)
4 </cfscript> 
5  
6 <cfset output = "hello from getDocList <br>">
7 <cfloop collection="#CGI#" item="currProp"> 
8     <cfset output = output & currProp & " = " & CGI[currProp] & "<br>">
9 </cfloop> 
10 <cfset output = output & "<hr>">
11  
12 <!--- <cffile action = "write" 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16 ---> 17 <cfdump var="#qDocList#"> 18 <cfset flash.result = qDocList>

ApplicationFiles/Flash/getHierQuery.cfm (25 lines)
1 <cfif ArrayLen(flash.params)> 
2     <cfset flag = "Yes">
3     <cfset docID = flash.params[1]>
4 <cfelse> 
5     <cfset flag = "No">
6     <cfset docID = 1>
7 </cfif> 
8 <cfset output = "flag = #flag# hello2 from getHierQuery.cfm;  <br> docID = #docID# <br> isDefined flash.params[1] =  <br>">
9  
10 <cfloop collection="#CGI#" item="currProp"> 
11     <cfset output = output & currProp & " = " & CGI[currProp] & "<br>">
12 </cfloop> 
13 <cfset output = output & "<hr>">
14  
15 <cffile action = "write" 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23 </cfscript> 24 25 <cfset flash.result = qHier>

ApplicationFiles/Flash/getmessage.cfm (3 lines)
1  
2 <CFSET flash.result = "hello from cf">
3  

ApplicationFiles/application.cfm (111 lines)
1 <CFSETTING ENABLECFOUTPUTONLY="Yes">
2 <!------------------------------------------------ 
3 File name: application.cfm 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18 5; 04/19/2002; jds; Added a blank JavaScript call to the Style Sheet call per 19 suggestions from Ray Camden. 20 6; 04/21/2002; Teo Graca; Modified to coding stadards, added CFSETTING tags, 21 set application variables to not be set for every page run, added 22 APPLICATION.stCommon.custtags.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36 <CFLOCK SCOPE="application" TYPE="READONLY" TIMEOUT="10"> 37 <CFIF StructKeyExists(APPLICATION,"stCommon")> 38 <CFSET Initialized=TRUE> 39 <CFELSE> 40 <CFSET Initialized=FALSE> 41 </CFIF> 42 </CFLOCK>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
105 the CFLOGIN because that is where session.UserProfile is set up. ---> 106 <CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="10"> 107 <CFSET REQUEST.ses.UserProfile = Duplicate(Session.UserProfile)> 108 </CFLOCK> 109 110 <CFSETTING ENABLECFOUTPUTONLY="No"> 111
Source code below from:
ColdFusion MX for Dummies
By John Paul Ashenfelter and Jon N. Kocen
Published 13 September, 2002
Average rating

      Powells     Alibris

application.cfm (3 lines)
1  
2 <!--- datasource name used for application ---> 
3 <CFSET DSN = "hrp">

code.cfm (114 lines)
11 <TABLE BORDER="1" CELLPADDING="6" WIDTH="650" ALIGN="center"><TR><TD> 
12 <!--- get current path of pages ---> 
13 <CFSET file_path = GetDirectoryFromPath(GetCurrentTemplatePath())>
14 <!--- default file name to nothing ---> 
15 <CFPARAM NAME="file_name" DEFAULT=""> 
16 <CFPARAM NAME="additional_file" DEFAULT=""> 
17  
18 <!--- detemine the file name to retrieve ---> 
19 <CFSWITCH EXPRESSION="#url.action#"> 
20     <!--- organization ---> 
21     <CFCASE VALUE="org"> 
22         <CFSET file_name = "organization.inc">
23     </CFCASE> 
24     <!--- index ---> 
25     <CFCASE VALUE="index"> 
26         <CFSET file_name = "index.inc">
27     </CFCASE> 
28     <!--- filter  ---> 
29     <CFCASE VALUE="filter"> 
30         <CFSET file_name = "filter.inc">
31     </CFCASE> 
32     <!--- results ---> 
33     <CFCASE VALUE="results"> 
34         <CFSET file_name = "results.inc">
35     </CFCASE> 
36     <!--- department ---> 
37     <CFCASE VALUE="dept"> 
38         <CFSET file_name = "department.inc">
39         <CFSET additional_file = "functions.inc">
40     </CFCASE> 
41     <!--- detail ---> 
42     <CFCASE VALUE="detail"> 
43         <CFSET file_name = "detail.inc">
44         <CFSET additional_file = "functions.inc">
45     </CFCASE> 
46     <!--- xml ---> 
47     <CFCASE VALUE="xml"> 
48         <CFSET file_name = "xml.inc">
49         <CFSET additional_file = "employee.xsl">
50     </CFCASE> 
51     <!--- webservices ---> 
Source code below from:
Mastering ColdFusion MX
By Arman Danesh, Raymond Camden, Selene Bainum, and Guy Rish
Published 13 September, 2002
Average rating

      Powells     Alibris

4124ch02/c0202.cfm (17 lines)
9      
10         <cfif not IsDefined("url.name")> 
11             <cfset url.name = "World">
12         </cfif> 
13          

4124ch02/c0203.cfm (17 lines)
8     <body> 
9      
10         <cfset name="World">
11          
12         <cfoutput> 

4124ch04/c0401.cfm (15 lines)
6     <body> 
7      
8         <cfset name="Guy Rish">
9          
10         <cfoutput> 

4124ch09/cfinclude.cfm (6 lines)
1 <cfset chosen=0>
2 <cfinclude template="head09.cfm"> 
3 <hr> 

4124ch11/c1106.cfm (52 lines)
16  
17    <!--- Create a variable to hold the number of rows returned. ---> 
18    <cfset NumRecords = RowCount.RowsSelected>
19  
20    <!--- Perform the update. ---> 
Source code below from:
Reality ColdFusion MX: Flash MX Integration
By Ben Forta, Randy Drisgill, Dennis Baldwin, Matt Tatam, and Derek Lu
Published 23 August, 2002
Average rating

      Powells     Alibris

au/com/tatam/Chat/dialog/Request.cfc (80 lines)
18  
19  <cfcomponent name="Request" hint="Manages the requests from the FlashChatUI"> 
20  <cfset     DSN_Session ="Chat">
21     <cfset  DSN_SessionDBType ="ODBC">
22 <!---******************************************************************************* 
23 o   Function name:  createChatRequest 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
53 <cffunction name="createChatRequest" access="remote"> 54 <CFTRY> 55 <cfset st_Return = StructNew() /> <!--- ---> 56 <cfset requestUUID = createUUID() /> 57 <cfquery datasource="#DSN_Session#" dbtype="#DSN_SessionDBType#" name="qry_deletePreviousChatRequest"> 58 DELETE * FROM
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
68 </cfquery> 69 70 <cfset st_Return.requestUUID = requestUUID/> 71 <cfreturn st_Return /> 72 <CFCATCH> 73 <cfset st_Return.requestUUID = 0/> 74 <cfreturn st_Return /> 75 </CFCATCH>

au/com/tatam/Chat/session/Session.cfc (268 lines)
19   <cfcomponent name="Session" hint="controlls the session"> 
20 <!--- **************************** --->  
21     <cfset  DSN_Session ="Chat" />
22     <cfset  DSN_SessionDBType ="ODBC" />
23 <!---******************************************************************************* 
24 o   Function name:  setNewSession 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63 64 <cfparam name="UserAuthenticated" default="0" /> 65 <cfset st_Return = StructNew() /> 66 <cfset st_Return.userID = arguments.userID /> 67 <cfset st_Return.sessionid = 00 /> 68 <cfinvoke component="au.com.tatam.User.User" 69 method="Authenticate"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
80 81 <!--- ---> 82 <!--- <cfset UserAuthenticated = true /> ---> 83 <cfif UserAuthenticated> 84 <cfset st_Return.sessionid = createUUID() /> 85 <!--- Default expiryTime is set in DB as Now + 1 hr ---> 86 <cfquery datasource="#DSN_Session#" dbtype="#DSN_SessionDBType#" name="qry_DeleteOldSessions">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
92 </cfquery> 93 <cfelse> 94 <cfset st_Return.sessionid = 0 /> 95 </cfif> 96
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
131 </cfquery> 132 <cffile file="c:\temp\cffile.txt" action="APPEND" output="here #DSN_Session.recordcount#" /> 133 <cfset UsersOnline = arrayNew(1) /> 134 <cfset usercountr = 1> 135 <cfloop query="qry_getCurrentSession" > 136 <!---- loops thru the query and populates the array that is returned ----> 137 <cfset UsersOnline[usercountr] = structnew() /> 138 <cfset UsersOnline[usercountr].alias = "#username#" /> 139 <cfset UsersOnline[usercountr].username="#username#" />

au/com/tatam/Database/query.cfc (291 lines)
24 *******************************************************************************************************--->  
25  <CFCOMPONENT > 
26 <cfsetting enablecfoutputonly="yes">
27 <!--- ***********  CheckMinimumAttributes Function  ********************* --->       
28     <CFFUNCTION NAME="CheckMinimumAttributes" ACCESS="PRIVATE" > 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
76 AND STRUCTKEYEXISTS(ARGUMENTS.data, "WHEREFieldValue")> 77 <!--- If all required struct keys exist then set return value to True ---> 78 <CFSET DATAOK="True" /> 79 <CFELSE> 80 <!--- ELSE If all required struct keys DO NOT exist then set return value to False ---> 81 <CFSET DATAOK="False" /> 82 </CFIF> 83 <!--- Return DATAOK [Boolean] ---> 84 <CFRETURN DATAOK /> 85 <CFCATCH> 86 <!--- If ERROR Occurs the return False ---> 87 <CFSET DATAOK="False" /> 88 <CFRETURN DATAOK /> 89 </CFCATCH>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
150 </CFQUERY> 151 <CFIF Select.RecordCount GT 1> 152 <CFSET ReturnValue = Select /> 153 <!--- Returns a Query if there are more than one record returned---> 154 <CFELSE> 155 <CFSET ReturnValue = SELECT[#ARGUMENTS.DATA.REQUESTEDFIELDNAME#] /> 156 <!--- Returns the field Value if there is only one record---> 157 </CFIF> 158 <CFELSE> 159 <!--- If false is returned from the function CheckMinimumAttributes 160 then this value needs to distinguish it from genuine value ---> 161 <CFSET ReturnValue="****ERROR****All Data Must Be Supplied****" /> 162 <!--- !!!!!!! MAYBE a CFTHROW ? !!!!!!!!! ---> 163 </CFIF>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
166 <CFCATCH> 167 <!--- If An error doesOccur then return with prefix ERROR**** ---> 168 <CFSET ReturnValue="****ERROR****Message: #CFCATCH.Message#" /> 169 <!--- !!!!!!! MAYBE a CFTHROW or return the CFCATCH variable ? !!!!!!!!! ---> 170 <CFRETURN ReturnValue />
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
268 </CFIF> 269 <!--- Return a true value if the UPDATE executed correctly ---> 270 <CFSET RETURNVALUE ="True" /> 271 <CFRETURN RETURNVALUE /> 272 <CFCATCH> 273 <!--- Return a the ERROR value if the UPDATE executed incorrectly ---> 274 <CFSET RETURNVALUE="****ERROR**** Message: #cfcatch.message#"> 275 <CFRETURN RETURNVALUE /> 276 </CFCATCH>

au/com/tatam/User/cfcTemplateIncludes/UserAddress.cfm (43 lines)
18             Description : Comments 
19 *******************************************************************************************************--->  
20 <cfset arguments = "#attributes.arguments#" />
21 <cftry> 
22   
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32 33 <!---- returns a query object ----> 34 <cfset caller["#attributes.returnVariable#"] = Users /> 35 <!--- <cfdump var="#caller['#attributes.returnVariable#']#"> ---> 36 <cfcatch> 37 <cfset caller["#attributes.returnVariable#"] = false /> 38 <cfoutput>Error </cfoutput> 39 <cfdump var="#cfcatch.message#" />

au/com/tatam/User/cfcTemplateIncludes/createUser.cfm (106 lines)
16             Description : Comments 
17 *******************************************************************************************************--->  
18 <cfset arguments = "#attributes.arguments#" />
19 <cftry> 
20  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29 </cfquery> 30 <cfif getLastUserID.LastUserID GTE 1> 31 <cfset int_UserID = int(getLastUserID.LastUserID + 1) /> 32 <cfelse> 33 <cfset int_UserID = 1 /> 34 </cfif> 35 <!--- <cfdump var="#int_UserID#" /> --->
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
97 </cftransaction> 98 <!--- Must enforce Referential Integrity ---> 99 <cfset caller["#attributes.returnVariable#"] = true /> 100 <cfcatch> 101 <cfset caller["#attributes.returnVariable#"] = false /> 102 <cfoutput>Error </cfoutput> 103 <cfdump var="#cfcatch.message#" />
Source code below from:
Advanced Macromedia ColdFusion 5 Application Development (2nd Edition)
By Ben Forta, Dain Anderson, Shawn Evans, Benjamin Elmore, Paul Hastings, Nate Weiss, Jeff Taylor, Emily B. Kim, David Krasnove, and Robert Panico
Published 17 September, 2001
Average rating

      Powells     Alibris

AdvancedCF/Chapter01/listing1.cfm (93 lines)
1 <CFSETTING enablecfoutputonly="yes">
2  
3 <!--- did the user ask to swap locales? ---> 
4 <CFIF isDefined("form.newLocale")> 
5     <CFSET client.primeLangauge=Left(form.newLocale,2)>
6     <CFSET client.locale=form.newLocale>
7 </CFIF> 
8  
9 <CFIF isDefined("client.primeLanguage") AND isDefined("client.locale")> 
10     <CFSET primeLanguage=client.primeLanguage>
11     <CFSET locale=client.locale>
12 <CFELSE> 
13 <!--- if not, lets see what language their browser is using ---> 
14  
15 <!--- only care about languages, ignore the rest of this string ---> 
16 <CFSET strPos=FindNoCase(";", cgi.HTTP_ACCEPT_LANGUAGE,1)-1>
17 <CFSET theseLanguages=Left(cgi.HTTP_ACCEPT_LANGUAGE,strPos)>
18 <!-- more than one language installed? even non-English users will very  
19     often have US or other English languages installed  ---> 
20 <CFIF variables.theseLanguages CONTAINS ","> <!--- yup more than one language ---> 
21     <!--- we'll assume that the default language is the 1st in the list  ---> 
22     <CFSET locale=ListFirst(theseLanguages)> 
23 <CFELSE> <!--- lucky us, only one language --->  
24     <CFSET locale=theseLanguages>
25 </CFIF> 
26  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29 one, for example: en vs en-us 30 ---> 31 <CFSET primeLanguage=Left(locale,2)> 32 33 <!--- lets stock this user's language away ---> 34 <CFSET client.primeLanguage=primeLanguage> 35 <CFSET client.locale=locale> 36 </CFIF> <!--- old user? --->

AdvancedCF/Chapter01/listing11.cfm (49 lines)
7 <!--- this will be common to all locales ---> 
8 <!--- what day? ---> 
9 <CFSET thisDay=DayOfWeek(now())>
10 <!--- what month? ---> 
11 <CFSET theMonth=Month(Now())>
12 <CFSET theMonths=StructFind(theMonths,defaultLanguage)>
13 <CFSET thisMonth=theMonths[theMonth]>
14 <!--- get the year in this locale ---> 
15 <cf_LocaleYear yearAD="#year(Now())#" calendar="#getLocaleInfo.calType#"> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18 <!--- note localeyear is returned by the cf_localeYear custom tag above ---> 19 <CFCASE value="d. M. yyyy"> 20 <CFSET today=thisDay&". "&thisMonth&". "&localeYear> 21 </CFCASE> 22 <CFCASE value="d.M.yyyy,dd.M.yyyy,dd.MM.yyyy"> 23 <CFSET today=thisDay&"."&thisMonth&"."&localeYear> 24 </CFCASE> 25 <CFCASE value="d/M/yyyy,d/MM/yyyy,dd/MM/yyyy"> 26 <CFSET today=thisDay&"/"&thisMonth&"/"&localeYear> 27 </CFCASE> 28 <CFCASE value="dd-MM-yyyy,d-M-yyyy"> 29 <CFSET today=thisDay&"-"&thisMonth&"-"&localeYear> 30 </CFCASE> 31 <CFCASE value="M/d/yyyy,MM/dd/yyyy"> 32 <CFSET today=thisMonth&"/"&thisDay&"/"&localeYear> 33 </CFCASE> 34 <CFCASE value="yyyy. MM. dd."> 35 <CFSET today=localeYear&". "&thisMonth&". "&thisDay&"."> 36 </CFCASE> 37 <CFCASE value="yyyy.MM.dd"> 38 <CFSET today=localeYear&"."&thisMonth&"."&thisDay> 39 </CFCASE> 40 <CFCASE value="yyyy.MM.dd.">

AdvancedCF/Chapter01/listing13.cfm (68 lines)
1 <CFSETTING enablecfoutputonly="yes">
2 <!--- if this fellow is an old user, we should have him in our client db ---> 
3 <CFIF isDefined("client.primeLanguage")> 
4     <CFSET primeLanguage=client.primeLanguage>
5 <CFELSE><!--- if not, lets see what language their browser is using ---> 
6 <!--- only care about languages, ignore the rest of this string ---> 
7 <CFSET strPos=FindNoCase(";", cgi.HTTP_ACCEPT_LANGUAGE,1)-1>
8  
9 <CFIF strPos LTE 0> 
10     <CFSET theseLanguages=CGI.HTTP_ACCEPT_LANGUAGE>
11 <CFELSE> 
12     <CFSET theseLanguages=Left(cgi.HTTP_ACCEPT_LANGUAGE,strPos)>
13 </CFIF><!-- more than one language installed? even non-English users will very 
14     often have US or other English languages installed  ---> 
15 <CFIF variables.theseLanguages CONTAINS ","> <!--- more than one language ---> 
16     <!--- the default language is the 1st in the list  ---> 
17     <CFSET defaultLanguage=ListFirst(theseLanguages)>
18 <CFELSE> <!--- lucky us, only one language ---> 
19     <CFSET defaultLanguage=theseLanguages>
20 </CFIF> 
21  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 one, for example: en vs en-us 25 ---> 26 <CFSET primeLanguage=Left(defaultLanguage,2)> 27 28 <!--- lets stock this user's language away ---> 29 <CFSET client.primeLanguage=primeLanguage> 30 </CFIF> <!--- old user? ---> 31
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 <!--- move this to a session var ---> 38 <cflock SCOPE="SESSION" TIMEOUT="10" THROWONTIMEOUT="Yes" TYPE="EXCLUSIVE"> 39 <CFSET session.primeLanguage=primeLanguage> 40 </cflock> 41 42 <!--- bob is now your uncle ---> 43 44 <CFSETTING enablecfoutputonly="No"> 45 46 <html>

AdvancedCF/Chapter01/listing14.cfm (110 lines)
12  
13 <!--- now comes the tricky part, loading the structures ---> 
14 <CFSET formWords = StructNew()>
15 <CFOUTPUT QUERY="getWords" GROUP="countryCode"> 
16     <CFSET "formWords.#countryCode#"=StructNew()>
17     <CFOUTPUT> 
18         <CFSET "formWords.#countryCode#.#formItem#"="#itemString#">
19     </CFOUTPUT> 
20 </CFOUTPUT> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28 </CFQUERY> 29 30 <CFSET menuWords = StructNew()> 31 <CFOUTPUT QUERY="getWords" GROUP="countryCode"> 32 <CFSET "menuWords.#countryCode#"=StructNew()> 33 <CFOUTPUT> 34 <CFSET "menuWords.#countryCode#.#menuItem#"="#itemString#"> 35 </CFOUTPUT> 36 </CFOUTPUT>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43 </CFQUERY> 44 45 <CFSET orderWords = StructNew()> 46 <CFOUTPUT QUERY="getWords" GROUP="countryCode"> 47 <CFSET "orderWords.#countryCode#"=StructNew()> 48 <CFOUTPUT> 49 <CFSET "orderWords.#countryCode#.#pageItem#"="#itemString#"> 50 </CFOUTPUT> 51 </CFOUTPUT>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
58 </CFQUERY> 59 60 <CFSET guestWords = StructNew()> 61 <CFOUTPUT QUERY="getWords" GROUP="countryCode"> 62 <CFSET "guestWords.#countryCode#"=StructNew()> 63 <CFOUTPUT> 64 <CFSET "guestWords.#countryCode#.#formItem#"="#itemString#">

AdvancedCF/Chapter01/listing15.cfm (84 lines)
1 <CFSETTING enablecfoutputonly="yes">
2     <CFSET start=evaluate("application.menuWords.#session.primeLanguage#.start")>
3     <CFSET bugs=evaluate("application.menuWords.#session.primeLanguage#.bugs")>
4     <CFSET forums=evaluate("application.menuWords.#session.primeLanguage#.forums")>
5     <CFSET manual=evaluate("application.menuWords.#session.primeLanguage#.manual")>
6     <CFSET updates=evaluate("application.menuWords.#session.primeLanguage#.updates")>
7     <CFSET comments=evaluate("application.menuWords.#session.primeLanguage#.comments")>
8     <CFSET mail=evaluate("application.menuWords.#session.primeLanguage#.mail")>
9     <CFSET elist=evaluate("application.menuWords.#session.primeLanguage#.elist")>
10     <CFSET help=evaluate("application.menuWords.#session.primeLanguage#.help")>
11     <CFSET orderCD=evaluate("application.menuWords.#session.primeLanguage#.orderCD")>
12 <CFSETTING enablecfoutputonly="No"> 
13 <!-- This document was created with HomeSite v2.0 --> 
Source code below from:
Programming ColdFusion
By Rob Brooks-Bilson
Published 06 August, 2001
Average rating

      Powells     Alibris

Chapter10/10-22.cfm (47 lines)
4       so we set the ParentItemID to 0. ---> 
5 <CFIF ISDEFINED("Attributes.ParentItemID")> 
6   <CFSET ParentItemID = Attributes.ParentItemID>
7 <CFELSE> 
8   <CFSET ParentItemID = 0>
9 </CFIF> 
10  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
23 image to document ---> 24 <CFIF LINKURL IS ""> 25 <CFSET IMAGE="folder"> 26 <CFELSE> 27 <CFSET IMAGE="Document"> 28 </CFIF> 29

Chapter11/11-23.cfm (38 lines)
1 <!--- set ID = 1.  Normally, this value would come from a form post or as  
2       a URL parameter ---> 
3 <CFSET ID = 1>
4  
5 <!--- retrieve the full record of the employee whose ID is specified.   

Chapter11/11-27.cfm (96 lines)
1 <!--- Initialize a variable called Continue to control the transaction ---> 
2 <CFSET Continue = "Yes">
3  
4 <!--- begin transaction ---> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 <CFCATCH TYPE="Database"> 22 <CFTRANSACTION ACTION="ROLLBACK"/> 23 <CFSET ProblemQuery = "MakeSalesDirectory"> 24 <CFSET Continue = "No"> 25 </CFCATCH> 26 </CFTRY>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
41 <CFCATCH TYPE="DATABASE"> 42 <CFTRANSACTION ACTION="ROLLBACK"/> 43 <CFSET ProblemQuery = "InsertRecord"> 44 <CFSET Continue = "No"> 45 </CFCATCH> 46 </CFTRY>

Chapter11/11-3.cfm (30 lines)
8 <H2>Two column output sorted left to right</H2> 
9 <!--- initialize the STARTNEWROW variable as True ---> 
10 <CFSET StartNewRow = True>
11  
12 <!--- The CFPROCESSING tag suppresses extra whitespace as much as possible.   
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 <TD>#Name#</TD> 22 <!--- set STARTNEWROW to the opposite of its currnet True/False value ---> 23 <CFSET StartNewRow = NOT(StartNewRow)> 24 <!--- if STARTNEWROW is True, add a /TR to close the row ---> 25 <CFIF StartNewRow IS True>

Chapter11/11-4.cfm (62 lines)
9  
10 <!--- Columns sets the total number of output columns. --->  
11 <CFSET Columns = 3>
12 <CFSET CurrentColumn = 0>
13 <CFSET RowCompleted = 0>
14 <!--- Set the total number of rows equal to the number of records divided by  
15       the number of columns. --->  
16 <CFSET Rows=Int(GetEmployeeInfo.RecordCount/Columns)>
17 <!--- Set a variable to hold the number of columns with extra records ---> 
18 <CFSET OddColumns = GetEmployeeInfo.RecordCount MOD Columns>
19 <!--- if there are columns with extra records, increase the number of rows by  
20       one ---> 
21 <CFIF OddColumns NEQ 0> 
22   <CFSET Rows = IncrementValue(Rows)>
23 </CFIF> 
24 <CFSET Increment = IncrementValue(Int(GetEmployeeInfo.RecordCount/Columns))>
25  
26 <H2>Multicolumn Query Output Sorted Top to Bottom</H2> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
31 of output rows needed ---> 32 <CFLOOP FROM="1" TO="#rows#" INDEX="Row"> 33 <CFSET LeftOverIncrement = 0> 34 <TR> 35 <!--- create an inner loop for handling each column ---> 36 <CFLOOP INDEX="Column" FROM="1" TO="#Columns#"> 37 <CFIF Column GT (OddColumns + 1) > 38 <CFSET LeftOverIncrement = IncrementValue(LeftOverIncrement)> 39 </CFIF> 40 <!--- Set the current row and column ---> 41 <CFSET CurrentRow = (Row + (Increment * (CurrentColumn) ) - LeftOverIncrement) > 42 <CFSET CurrentColumn = IIf(CurrentColumn is (columns - 1),0 ,IncrementValue(CurrentColumn))> 43 <!--- Output the current row ---> 44 <CFOUTPUT>
Source code below from:
Professional ColdFusion 5.0
By Simon Horwith, Paulo Rios, Sander Duivestein, Ryan O'Keefe, Nicole Ambrose-Haynes, Daniel Newsome, Robert Segal, Andrew Wintheiser, Karen Little, and Herb Guenther
Published 15 June, 2001
Average rating

      Powells     Alibris

ProCF/Ch14/TimeCFSETvsCFSCRIPT.cfm (40 lines)
1 <!--- CFSET --->
2 <!--- Get time to carry out loop ---> 
3 <cfset loopstart = getTickCount() >
4 <cfloop index="i" from="1" to="1000"></cfloop> 
5 <cfset looptime = getTickCount()  - loopstart>
6  
7 <!--- Carry out variable assignment---> 
8 <cfset array = ArrayNew(1) >
9 <cfset temp = ArraySet(array,1,1000,"")>
10 <cfset start = getTickCount()>
11 <cfloop index="i" from="1" to="1000"> 
12 <cfset array[i] = i>
13 </cfloop> 
14  
15 <!--- Get time to carry out variable assignment ---> 
16 <cfset finish = getTickCount() - start - looptime>
17 Time taken to set 1000 variables using CFSET:<cfoutput> #finish# </cfoutput>milliseconds
18 <p></p> 
19  

ProCF/Ch14/TimeCFSETvsCFSCRIPT2.cfm (15 lines)
1 <!--- CFLOOP INDEX ---> 
2 <cfset start = getTickCount()>
3 <cfloop index="i" from=1 to=10000> 
4 </cfloop> 
5 <cfset finish = getTickCount() - start>
6 The time taken to loop 10000 times using CFLOOP is <cfoutput> #finish# </cfoutput>milliseconds 
7 <P> 

ProCF/Ch04/helloworld.cfm (22 lines)
7  
8 <!--- Set a variable called name with the value of Ryan ---> 
9 <cfset name = "Ryan">
10 <br><br> 
11  

ProCF/Ch05/variables.cfm (11 lines)
1 <cfset CapitalOfUnitedKingdom = "London">
2 <cfset Favorite_Food = "Pasta">
3 <cfset Price = 24.99>
4 <cfset Important_Day = "8th March 2001">   
5  
6 <cfoutput> 

ProCF/Ch06/a_doregister.cfm (128 lines)
98         <!--- If it doesn't, send them back to the form ---> 
99         <cfinclude template="register.cfm"> 
100         <CFSET test="foo">
101         <cfabort> 
102     </cfif> 
Source code below from:
ColdFusion X Professional Projects (Professional Projects)
By Rohit Kochar and Parag Rastogi
Published 24 March, 2003
Average rating

      Powells     Alibris

AppraisalForm.CFM (91 lines)
15 <CFIF get_Appraisal_ID.RECORDCOUNT GT 0> 
16     <CFOUTPUT QUERY = "get_Appraisal_ID"> 
17         <CFSET varAppID = #AppID#>
18         <CFSET SESSION.CurrentAppID = #AppID#>
19         <CFSET varAppraisalPeriod = #AppraisalPeriod#>
20         <CFSET varAppraisalYear = #AppraisalYear#>
21         <CFSET varReviewerCode = #ReviewerCode#>
22     </CFOUTPUT> 
23  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28 </CFQUERY> 29 <CFOUTPUT QUERY = "get_Employee_Name"> 30 <CFSET varReviewerName = #EmployeeName#> 31 </CFOUTPUT> 32 <CFQUERY NAME="get_Appraisal_info" DATASOURCE=#SESSION.DSN#>

AppraisalReviewerForm.CFM (65 lines)
15 <CFIF get_Appraisal_ID.RECORDCOUNT GT 0> 
16     <CFOUTPUT QUERY = "get_Appraisal_ID"> 
17         <CFSET varAppID = #AppID#>
18         <CFSET SESSION.CurrentAppID = #AppID#>
19         <CFSET varAppraisalPeriod = #AppraisalPeriod#>
20         <CFSET varAppraisalYear = #AppraisalYear#>  
21     </CFOUTPUT> 
22     <cfinvoke component="ConvertQuarterToText" method="TextQtr" returnVariable="QtrInText" QtrNumber=#varAppraisalPeriod#> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26 </CFQUERY> 27 <CFOUTPUT QUERY = "get_Employee_Name"> 28 <CFSET varEmployeeName = #EmployeeName#> 29 </CFOUTPUT> 30

CallValidate.cfm (68 lines)
1 <cfswitch expression="#Form.country#"> 
2   <cfdefaultcase> 
3     <cfset SESSION.DSN = "ElectricComp">
4     <cfset SESSION.Country = "USA">
5   </cfdefaultcase>  
6   <cfcase value="USA"> 
7     <cfset SESSION.DSN = "ElectricComp">
8     <cfset SESSION.Country = "USA">
9   </cfcase> 
10   <cfcase value="Austria"> 
11     <cfset SESSION.DSN = "ElectricComp">
12     <cfset SESSION.Country = "Austria">
13   </cfcase> 
14   <cfcase value="Brazil"> 
15     <cfset SESSION.DSN = "ElectricComp">
16     <cfset SESSION.Country = "Brazil">
17   </cfcase> 
18 </cfswitch> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27 </DIV> 28 <BR> 29 <cfset timeout = 300> 30 <cflogin idleTimeout="#timeout#"> 31 <cfinvoke component="ValidateEmployee" method="getRoles" returnVariable="ResultRoles" strEmpCode=#Form.empcode# strEmpPassword=#Form.password# strEmpDataSource=#SESSION.DSN#>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51 </cflogin> 52 53 <CFSET SESSION.EmpCode = #Form.empcode#> 54 <cfswitch expression="#Form.approle#"> 55 <cfdefaultcase>

ConvertQuarterToText.cfc (23 lines)
4         <cfswitch expression=#arguments.QtrNumber#> 
5               <cfdefaultcase> 
6                 <cfset myResult = "Jan-Mar">
7               </cfdefaultcase>  
8               <cfcase value=1> 
9                 <cfset myResult = "Jan-Mar">
10               </cfcase> 
11               <cfcase value="2"> 
12                 <cfset myResult = "Apr-June">
13               </cfcase> 
14               <cfcase value="3"> 
15                 <cfset myResult = "July-Sep">
16               </cfcase> 
17               <cfcase value="4"> 
18                 <cfset myResult = "Oct-Dec">
19               </cfcase> 
20         </cfswitch>      

ProcessReviewerMain.cfm (131 lines)
16     </CFQUERY> 
17     <CFIF FindAppraisal.RECORDCOUNT EQ 0> 
18         <cfset varHeaderFlag = "Yes">
19         <cfset varTargetCount = 1>
20         <CFLOOP INDEX = "element" FROM = "1" TO="6">         
21             <cfset varTarget = Evaluate("Form.#element#")>
22             <CFIF varTarget GT ""> 
23                 <CFIF varHeaderFlag EQ "Yes"> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33 </CFQUERY> 34 <cfoutput query="GetAppraisalID"> 35 <cfset varAppID = #AppraisalID#> 36 </cfoutput> 37 <cfset varHeaderFlag = "No"> 38 </CFIF> 39 <CFQUERY NAME="AddTargets" DATASOURCE=#SESSION.DSN#> 40 INSERT INTO tblQtrlyAppraisalDetails(AppraisalID,TargetID,Targets) 41 VALUES (#varAppID#,#varTargetCount#,'#varTarget#') 42 </CFQUERY> 43 <cfset varTargetCount = varTargetCount + 1> 44 </CFIF> 45 </CFLOOP>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56 </CFIF> 57 <CFIF trim(#Form.btnActivity#) EQ "Rate Current Targets"> 58 <cfset SESSION.SELEMP = #Form.Selected_Employee#> 59 <CFLOCATION URL="AppraisalReviewerForm.cfm" ADDTOKEN="no"> 60 </CFIF> 61 <CFIF Trim(Form.btnActivity) EQ "Show Annual Performance"> 62 <cfset SESSION.SELEMP = #Form.Selected_Employee#> 63 <cfset SESSION.SELAppPeriod = #Form.AppPeriod#> 64 <cfset SESSION.SELAppYear = #Form.AppYear#> 65 <cfset SESSION.SELBUTTON = "Show Annual Performance"> 66 <CFLOCATION URL="ViewPerformanceReviewer.cfm" ADDTOKEN="no"> 67 </CFIF>

Not satisfied? Try this search biased towards software and programming:
Google