Detailed instructions for use are in the User's Guide.
[. . . ] Except as permitted by such license, no part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, recording, or otherwise, without the prior written permission of Macromedia Incorporated. ColdFusion and HomeSite are federally registered trademarks of Macromedia Incorporated. HomeSite, the ColdFusion logo and the Allaire logo are trademarks of Macromedia Incorporated in the USA and other countries. Microsoft, Windows, Windows NT, Windows 95, Microsoft Access, and FoxPro are registered trademarks of Microsoft Corporation. [. . . ] </cfloop> <cfloop condition = "expression"> <cfloop query = "query_name" startRow = "row_num" endRow = "row_num"> <cfloop index = "index_name" list = "list_items" delimiterS = "item_delimiter"> </cfloop>
CFML Quick Reference
7
cfmail
<cfmail to = "recipient" from = "sender" cc = "copy_to" Bcc = "blind_copy_to" subject = "msg_subject" type = "msg_type" maxRows = "max_msgs" MIMEAttach = "path" query = "query_name" group = "query_column" groupCaseSensitive = "Yes" or "No" startRow = "query_row" server = "servername" port = "port_ID" mailerID = "headerid" timeout = "seconds">
cfmailparam
<cfmail to = "recipient" subject = "msg_subject" from = "sender" . . . more attibutes. . . > <cfmailparam file = "file-name" > or <cfmailparam name = "header-name" value = "header-value" > . . . </cfmail>
cfmodule
<cfmodule template = "template" name = "tag_name" attributeCollection = "collection_structure" attribute_name1 = "value" attribute_name2 = "value" . . . >
cfobject
<cfobject type = "COM" action = "action" class = "program_ID" name = "text" context = "context" server = "server_name"> <cfobject type = "CORBA" context = "context" class = "file or naming service" name = "text" locale = "type-value arguments"> <cfobject action = "Create" type = "Java" class = "Java class" name = "object name">
cfoutput
<cfoutput query = "query_name" group = "query_column" groupCaseSensitive = "Yes" or "No" startRow = "start_row" maxRows = "max_rows_output"> </cfoutput>
cfparam
<cfparam name = "param_name" type = "data_type"> default = "value">
cfpop
<cfpop server = "servername" port = "port_number" username = "username" password = "password" action = "action" name = "queryname" messageNumber = "number" attachmentPath = "path"
8
CFML Quick Reference
timeout = "seconds" maxRows = "number" startRow = "number" generateUniqueFilenames = "boolean">
cfprocessingdirective
<cfprocessingdirective suppressWhiteSpace = "Yes" or "No"> . . . </cfprocessingdirective>
cfprocparam
<cfprocparam type = "IN or OUT or INOUT" variable = "variable name" dbVarName = "DB variable name" value = "parameter value" CFSQLType = "parameter datatype" maxLength = "length" scale = "decimal places" null = "Yes" or "No">
cfprocresult
<cfprocresult name = "query_name" resultSet = "1-n" maxRows = "maxrows">
cfquery
<cfquery name = "query_name" dataSource = "ds_name" dbType = "type" dbServer = "dbms" dbName = "database name" connectString = "connection string" username = "username" password = "password" maxRows = "number" blockFactor = "blocksize" timeout = "milliseconds" cachedAfter = "date" cachedWithin = "timespan" provider = "COMProvider" providerDSN = "datasource" debug> SQL statements </cfquery>
cfqueryparam
<cfquery name = "query_name" dataSource = "ds_name" . . . other attributes. . . > SELECT STATEMENT WHERE column_name = <cfqueryPARAM value = "parameter value" CFSQLType = "parameter type" maxLength = "maximum parameter length" scale = "number of decimal places" dbName = "database name" null = "Yes" or "No" list = "Yes" or "No" separator = "separator character"> AND/OR . . . additional criteria of the WHERE clause. . . </cfquery>
cfregistry
<cfregistry action = "getAll" branch = "branch" type = "data type" name = "query name" sort = "criteria"> <cfregistry action = "get" branch = "branch" entry = "key or value" variable = "variable" type = "data type"> <cfregistry action = "set" branch = "branch" entry = "key or value" type = "value type" value = "data"> <cfregistry action = "delete" branch = "branch" entry = "keyorvalue">
CFML Quick Reference
9
cfreport
<cfreport report = "report_path" orderBy = "result_order" username = "username" password = "password" formula = "formula"> </cfreport>
cfrethrow
<cfrethrow>
cfsavecontent
<cfsavecontent variable = "variable name"> content </cfsavecontent>
cfschedule
<cfschedule action = "update" task = "taskname" operation = "HTTPRequest" file = "filename" path = "path_to_file" startDate = "date" startTime = "time" url = "URL" publish = "Yes" or "No" endDate = "date" endTime = "time" interval = "seconds" requestTimeOut = "seconds" username = "username" password = "password" resolveURL = "Yes" or "No" proxyServer = "hostname" port = "port_number" proxyPort = "port_number"> <cfschedule action = "delete" task = "TaskName"> <cfschedule action = "Run" task = "TaskName">
cfscript
<cfscript> cfscript code goes here </cfscript>
cfsearch
<cfsearch name = "search_name" collection = "collection_name" type = "criteria" criteria = "search_expression" maxRows = "number" startRow = "row_number" external = "Yes" or "No" language = "language">
cfselect
<cfselect name = "name" required = "Yes" or "No" message = "text" onError = "text" size = "integer" multiple = "Yes" or "No" query = "queryname" selected = "column_value" value = "text" display = "text" passThrough = "HTML_attributes"> </cfselect>
cfservlet
<cfservlet code = "class name of servlet" jrunProxy = "proxy server" timeout = "timeout in seconds" writeOutput = "Yes" or "No" debug = "Yes" or "No"> <cfservletparam name = "parameter name" value = "value"> . . . </cfservlet>
10
CFML Quick Reference
cfservletparam
<cfservlet . . . > <cfservletparam name = "servlet parameter name" value = "servlet parameter value"> . . . <cfservletparam name = "servlet attribute name" variable = "coldfusion variable name" type = "INT" or "DOUBLE" or "BOOL" or "DATE" or "STRING"> . . . </cfservlet>
cfset
<cfset variable_name = expression>
cfsetting
<cfsetting enableCFoutputOnly = "Yes" or "No" showDebugOutput = "Yes" or "No" catchExceptionsByPattern = "Yes" or "No">
cfsilent
<cfsilent>
cfslider
<cfslider name = "name" label = "text" refreshLabel = "Yes" or "No" img = "filename" imgStyle = "style" range = "min_value, max_value" scale = "uinteger" value = "integer" onValidate = "script_name" message = "text" onError = "text" height = "integer" width = "integer" vSpace = "integer" hSpace = "integer" align = "alignment" tickMarkMajor = "Yes" or "No" tickMarkMinor = "Yes" or "No" tickMarkImages = "URL1, URL2, URLn" tickMarkLabels = "Yes" or "No" or "list" lookAndFeel = "motif" or "windows" or "metal" vertical = "Yes" or "No" grooveColor = "color" bgColor = "color" textColor = "color" font = "font_name" fontSize = "integer" italic = "Yes" or "No" bold = "Yes" or "No" notSupported = "text">
cfstoredproc
<cfstoredproc procedure = "procedure name" dataSource = "ds_name" dbType = "type" username = "username" password = "password" dbServer = "dbms" connectString = "connection string" dbName = "database name" blockFactor = "blocksize" provider = "COMProvider" providerDSN = "datasource" debug = "Yes" or "No" returnCode = "Yes" or "No">
cfswitch
cfcase
cfdefaultcase
<cfswitch expression = "expression"> <cfcase value = "value" delimiters = "delimiters"> HTML and CFML tags </cfcase> additional <cfcase></cfcase> tags <cfdefaultcase> HTML and CFML tags </cfdefaultcase> </cfswitch>
CFML Quick Reference
11
cftable
<cftable query = "query_name" maxRows = "maxrows_table" colSpacing = "number_of_spaces" headerLines = "number_of_lines" HTMLTable border colHeaders startRow = "row_number"> </cftable>
cftextinput
<cftextinput name = "name" value = "text" required = "Yes" or "No" range = "min_value, max_value" validate = "data_type" onValidate = "script_name" message = "text" onError = "text" size = "integer" font = "font_name" fontSize = "integer" italic = "Yes" or "No" bold = "Yes" or "No" height = "integer" width = "integer" vSpace = "integer" hSpace = "integer" align = "alignment" bgColor = "color" textColor = "color" maxLength = "integer" notSupported = "text">
cfthrow
<cfthrow type = "exception_type " message = "message" detail = "detail_description " errorCode = "error_code " extendedInfo = "additional_information ">
cftransaction
<cftransaction action = "begin" or "commit" or "rollback" isolation = "Read_Uncommitted" or "Read_Committed" or "Repeatable_Read" > </cftransaction>
cftree
<cftree name = "name" required = "Yes" or "No" delimiter = "delimiter" completePath = "Yes" or "No" appendKey = "Yes" or "No" highlightHref = "Yes" or "No" onValidate = "script_name" message = "text" onError = "text" lookAndFeel = "motif" or "windows" or "metal" font = "font" fontSize = "size" italic = "Yes" or "No" bold = "Yes" or "No" height = "integer" width = "integer" vSpace = "integer" hSpace = "integer" align = "alignment" border = "Yes" or "No" hScroll = "Yes" or "No" vScroll = "Yes" or "No" notSupported = "text"> </cftree>
cftreeitem
<cftreeitem value = "text" display = "text" parent = "parent_name" img = "filename"
12
CFML Quick Reference
imgopen = "filename" href = "URL" target = "URL_target" query = "queryname" queryAsRoot = "Yes" or "No" expand = "Yes" or "No">
cftry cfcatch
<cftry> . . . Additional cfcatch blocks go here </cftry>
cfupdate
<cfupdate dataSource = "ds_name" dbType = "type" dbServer = "dbms" dbName = "database name" connectString = "connection string" tableName = "table_name" tableOwner = "name" tableQualifier = "qualifier" username = "username" password = "password" provider = "COMProvider" providerDSN = "datasource" formFields = "field_names">
cfwddx
<cfwddx action = "action" input = "inputdata" output = "resultvariablename" topLevelVariable = "toplevelvariablenameforjavascript" useTimeZoneInfo = "Yes" or "No" validate = "Yes" or "No">
CFML Quick Reference
13
CFML Functions
Array functions
ArrayAppend(array, value) ArrayAvg(array) ArrayClear(array) ArrayDeleteAt(array, position) ArrayInsertAt(array, position, value) ArrayIsEmpty(array) ArrayLen(array) ArrayMax(array) ArrayMin(array) ArrayNew(dimension) ArrayPrepend(array, value) ArrayResize(array, minimum_size) ArraySet(array, start_pos, end_pos, value) ArraySort(array, sort_type [, sort_order ]) ArraySum(array) ArraySwap(array, position1, position2) ArrayToList(array [, delimiter ]) IsArray(value [, number ]) ListToArray(list [, delimiter ])
Authentication functions
AuthenticatedContext() AuthenticatedUser() IsAuthenticated([security-context-name ]) IsAuthorized(resourcetype, resourcename [, action ])
Conversion functions
Hash(string) ToBase64(string or binary_object) ToBinary(string_in_Base64 or binary_value) ToString(any_value) URLDecode(urlEncodedString) URLEncodedFormat(string) XMLFormat(string)
Date and time functions
CreateDate(year, month, day) CreateDateTime(year, month, day, hour, minute, second) CreateODBCDate(date) CreateODBCDateTime(date) CreateODBCTime(date) CreateTime(hour, minute, second) CreateTimeSpan(days, hours, minutes, seconds) DateAdd(datepart, number, date) DateCompare(date1, date2 [, datePart]) DateConvert(conversion-type, date) DateDiff(datepart, date1, date2) DateFormat(date [, mask ]) DatePart(datepart, date) Day(date) DayOfWeek(date) DayOfWeekAsString(day_of_week) DayOfYear(date)
14
CFML Quick Reference
DaysInMonth(date) DaysInYear(date) FirstDayOfMonth(date) GetHttpTimeString(date_time_object) GetTimeZoneInfo() Hour(date) IsDate(string) IsLeapYear(year) IsNumericDate(number) LSDateFormat(date [, mask ]) LSIsDate(string) LSParseDateTime(date/time-string) LSTimeFormat(time [, mask ]) Minute(date) Month(date) MonthAsString(month_number) Now() ParseDateTime(date/time-string [, pop-conversion ] ) Quarter(date) Second(date) TimeFormat(time [, mask ]) Week(date) Year(date)
Decision functions
IsArray(value [, number ]) IsAuthenticated([security-context-name ]) IsAuthorized(resourcetype, resourcename [, action ]) FileExists(absolute_path) IsBinary(value) IsBoolean(value) IsCustomFunction(name) IsDate(string) IsDebugMode() IsDefined("variable_name") IsLeapYear(year) IsNumeric(string) IsNumericDate(number) IsProtected(resourcetype, resourcename [, action]) IsQuery(value) IsSimpleValue(value) IsStruct(variable ) IsWDDX(value) LSIsCurrency(string) LSIsDate(string) LSIsNumeric(string) ParameterExists(parameter)
Display and formatting functions
DateFormat(date [, mask ]) DecimalFormat(number) DollarFormat(number) FormatBaseN(number, radix) HTMLCodeFormat(string [, version ]) HTMLEditFormat(string [, version ]) LSCurrencyFormat(number [, type ]) LSDateFormat(date [, mask ])
CFML Quick Reference
15
LSEuroCurrencyFormat(currency-number [, type ]) LSNumberFormat(number [, mask ]) LSTimeFormat(time [, mask ]) NumberFormat(number [, mask ]) ParagraphFormat(string) TimeFormat(time [, mask ]) YesNoFormat(value)
Dynamic evaluation functions
DE(string) Evaluate(string_express1 [, string_express2 [, . . . ]]) IIf(condition, string_express1, string_express2) SetVariable(name, value)
International functions
DateConvert(conversion-type, date) GetHttpTimeString(date_time_object) GetLocale() GetTimeZoneInfo() LSCurrencyFormat(number [, type ]) LSDateFormat(date [, mask ]) LSEuroCurrencyFormat(currency-number [, type ]) LSIsCurrency(string) LSIsDate(string) LSIsNumeric(string) LSNumberFormat(number [, mask ]) LSParseCurrency(string) LSParseDateTime(date/time-string) LSParseEuroCurrency(currency-string) LSParseNumber(string) LSTimeFormat(time [, mask ]) SetLocale(new_locale)
List Functions
ArrayToList(array [, delimiter ]) ListAppend(list, value [, delimiters ]) ListChangeDelims(list, new_delimiter [, delimiters ]) ListContains(list, substring [, delimiters ]) ListContainsNoCase(list, substring [, delimiters ]) ListDeleteAt(list, position [, delimiters ]) ListFind(list, value [, delimiters ]) ListFindNoCase(list, value [, delimiters ]) ListFirst(list [, delimiters ]) ListGetAt(list, position [, delimiters ]) ListInsertAt(list, position, value [, delimiters ]) ListLast(list [, delimiters ]) ListLen(list [, delimiters ]) ListPrepend(list, value [, delimiters ]) ListQualify(list, qualifier [, delimiters ] [, elements ]) ListRest(list [, delimiters ]) ListSetAt(list, position, value [, delimiters ]) ListSort(list, sort_type [, sort_order] [, delimiter]) ListToArray(list [, delimiter ]) ListValueCount(list, value [, delimiters ]) ListValueCountNoCase(list, value [, delimiters ])
16
CFML Quick Reference
Mathematical functions
Abs(number) ACos(number) ASin(number) Atn(number) BitAnd(number1, number2) BitMaskClear(number, start, length) BitMaskRead(number, start, length) BitMaskSet(number, mask, start, length) BitNot(number) BitOr(number1, number2) BitSHLN(number, count) BitSHRN(number, count) BitXor(number1, number2) Ceiling(number) Cos(number) DecrementValue(number) Exp(number) Fix(number) IncrementValue(number) InputBaseN(string, radix) Insert(substring, string, position) Int(number) Log(number) Log10(number) Max(number1, number2) Min(number1, number2) Pi() Rand() Randomize(number) RandRange(number1, number2) Round(number) Sgn(number) Sin(number) Sqr(number) Tan(number)
Query functions
IsQuery(value) QueryAddColumn(query, column-name, array-name) QueryAddRow(query [, number ]) QueryNew(columnlist) QuerySetCell(query, column_name, value [, row_number]) QuotedValueList(query. column [, delimiter ]) ValueList(query. column [, delimiter ])
String functions
Asc(string) Chr(number) Cjustify(string, length) Compare(string1, string2) CompareNoCase(string1, string2) DayOfWeekAsString(day_of_week) Encrypt(string, seed) Find(substring, string [, start ]) FindNoCase(substring, string [, start ]) FindOneOf(set, string [, start ])
CFML Quick Reference
17
FormatBaseN(number, radix) GetToken(string, index [, delimiters ]) Hash(string) Insert(substring, string, position) JavaCast(type, variable) JSStringFormat(string) LCase(string) Left(string, count) Len(string or binary object) ListValueCount(list, value [, delimiters ]) ListValueCountNoCase(list, value [, delimiters ]) LJustify(string, length) LSIsCurrency(string) LSParseCurrency(string) LSParseDateTime(date/time-string) LSParseEuroCurrency(currency-string) LSParseNumber(string) LTrim(string) Mid(string, start, count) MonthAsString(month_number) ParseDateTime(date/time-string [, pop-conversion ] ) REFind(reg_expression, string [, start ] [, returnsubexpressions ] ) REFindNoCase(reg_expression, string [, start ] [, returnsubexpressions ] ) RemoveChars(string, start, count) RepeatString(string, count) Replace(string, substring1, substring2 [, scope ]) ReplaceList(string, list1, list2) ReplaceNoCase(string, substrng1, substrng2 [, scope]) REReplace(string, reg_express, substrng [, scope]) REReplaceNoCase(string, reg_express, substrng [, scope]) Reverse(string) Right(string, count) RJustify(string, length) RTrim(string) SpanExcluding(string, set) SpanIncluding(string, set) ToBase64(string or binary_object) Trim(string) UCase(string) Val(string)
Structure functions
Duplicate(variable_name) IsStruct(variable ) StructAppend(struct1, struct2, overwriteFlag) StructClear(structure) StructCopy(structure) StructCount(structure) StructDelete(structure, key [, indicatenotexisting ]) StructFind(structure, key) StructFindKey(top, key, scope) StructFindValue(struct top, string value [, scope]) StructGet(pathDesired) StructInsert(structure, key, value [, allowoverwrite]) StructIsEmpty(structure)
18
CFML Quick Reference
StructKeyArray(structure) StructKeyExists(structure, key) StructKeyList(structure, [delimiter]) StructNew() StructSort(base, pathToSubElement, sortOrder, sortType) StructUpdate(structure, key, value)
System functions
DirectoryExists(absolute_path) ExpandPath(relative_path) FileExists(absolute_path) GetCurrentTemplatePath() GetDirectoryFromPath(path) getException(object) GetFileFromPath(path) GetFunctionList() GetHttpRequestData() GetMetricData(mode) GetProfileString(iniPath, section, entry) GetTempDirectory() GetTempFile(dir, prefix) GetTemplatePath() SetProfileString(iniPath, section, entry, value)
Other functions
CreateObject("COM", class, context, serverName) CreateObject("CORBA", class, context, locale) CreateObject("Java", class) CreateUUID() Decrypt(encrypted_string, seed) DeleteClientVariable("name") Duplicate(variable_name) GetBaseTagData(tagname [, instancenumber ] ) GetBaseTagList() GetBaseTemplatePath() GetClientVariablesList() GetTickCount() Hash(string) PreserveSingleQuotes(variable) QuotedValueList(query. column [, delimiter ]) StripCR(string) ToBinary(string_in_Base64 or binary_value) URLDecode(urlEncodedString) URLEncodedFormat(string) ValueList(query. column [, delimiter ]) WriteOutput(string)
CFML Quick Reference
19
ColdFusion Variables
ColdFusion returns a wide variety of variables, such as those returned in a CFDIRECTORY or CFFTP operation. Variables are usually referenced by "scoping" the variable according to its type, as in Session. varname, or Application. varname.
Variable scope
ColdFusion supports the Variables scope. Unscoped variables created with the CFSET tag acquire the Variables scope by default. For example, the variable created by:
<CFSET linguist = Chomsky>
can be referenced as:
#Variables. linguist#
Client variables
These client variables are read-only:
Client. CFID Client. CFToken Client. HitCount Client. LastVisit Client. TimeCreated Client. URLToken
Server variables
Use the Server. prefix to reference server variables:
Server. ColdFusion. ProductName Server. ColdFusion. ProductVersion Server. ColdFusion. ProductLevel Server. ColdFusion. SerialNumber Server. ColdFusion. SupportedLocales Server. OS. Name Server. OS. AdditionalInformation Server. OS. Version Server. OS. BuildNumber
Application and session variables
Use CFAPPLICATION to enable application and session variables. They are referenced as:
Application. myvariable Session. myvariable
Use CFLOCK to ensure that modifications to shared data occur one after another. The predefined application and session variables are:
Application. ApplicationName Session. CFID Session. CFToken Session. URLToken 20 CFML Quick Reference
Custom tag variables
Any ColdFusion custom tag returns the following variables:
ThisTag. ExecutionMode ThisTag. HasEndTag ThisTag. GeneratedContent ThisTag. AssocAttribs[index]
A custom tag can also set a Caller variable to provide information to the caller. The Caller variable is set as follows:
<CFSET Caller. variable_name = "value">
The calling page can access the variable with the <CFOUTPUT> tag:
<CFOUTPUT>#Caller. variable_name#</CFOUTPUT>
Request variable
Request variables store data that pertains to the processing of a single page request. Request variables allow you to store data in a structure that can be passed to nested tags, such as Custom Tags, and processed once. The Request variable is set as follows:
<CFSET Request. field_name1 = "value"> <CFSET Request. field_name2 = "value"> <CFSET Request. field_name3 = "value"> . . .
Each nested tag can access the variable with the <CFOUTPUT> tag:
<CFOUTPUT>#Request. field_name1#</CFOUTPUT>
Form variable
ColdFusion supports the Form variable FieldNames. You can use it on the action page associated with a form.
Form. FieldNames
CFML Quick Reference
21
ColdFusion Tag-Specific Variables
A number of ColdFusion tags return data as variables. [. . . ] NOTE: The CGI variables that are available for your use vary with the Web server and configuration. Some of the following variables may not be available to you.
Request
CGI. AUTH_TYPE CGI. CONTENT_LENGTH CGI. CONTENT_TYPE CGI. PATH_INFO CGI. PATH_TRANSLATED CGI. QUERY_STRING CGI. REMOTE_ADDR CGI. REMOTE_HOST CGI. REMOTE_USER CGI. REQUEST_METHOD CGI. SCRIPT_NAME
Server
CGI. GATEWAY_INTERFACE CGI. SERVER_NAME CGI. SERVER_PORT CGI. SERVER_PROTOCOL CGI. SERVER_SOFTWARE
Client
CGI. CERT_ISSUER CGI. CERT_SUBJECT CGI. CLIENT_CERT_ENCODED CGI. HTTP_ACCEPT CGI. HTTP_IF_MODIFIED_SINCE CGI. HTTP_USER_AGENT
NOTE: The CERT_ISSUER, CERT_SUBJECT, CLIENT_CERT_ENCODED variables are available only if you are using client certificates.
CFML Quick Reference
27
ColdFusion Studio Keyboard Shortcuts
Studio offers a full set of keyboard commands for its tools and functions. The list below generally matches the order of the menu commands, with related shortcuts added. You can change shortcut key combinations and add new ones by opening the Options > Customize dialog and selecting the Keyboard Shortcuts tab.
File and document keyboard shortcuts File and Document Shortcuts Command
File > Open File > Save File > Save As File > Close File > Close All File > Print Open default template Insert Code Template text/open list Edit > Undo Edit > Redo Edit > Repeat Last Tag Edit > Cut Edit > Copy Edit > Paste Edit > Select All Edit > Indent Edit > Unindent Edit > Toggle Bookmark Edit > Goto Next Bookmark Edit > Goto line Goto previous document Goto next document Goto next start tag 28
Key
Ctrl + O Ctrl + S Shift + Ctrl + S Ctrl + W Shift + Ctrl + W Ctrl + P CTRL + N Ctrl + J Ctrl + Z Shift + Ctrl + Z Ctrl + Q Ctrl + X Ctrl + C Ctrl + V Ctrl + A Shift + Ctrl + . [. . . ]