ColdFusion tag-specific variables



Some ColdFusion tags return data as variables. For example, the cffile tag returns file size information in the FileSize variable, referenced as CFFILE.FileSize.

The following tags return data that you can reference in variables:

cfcatch 
cfdirectory 
cferror 
cffile 
cfftp 
cfhttp 
cfindex 
cfldap 
cfpop 
cfquery 
cfregistry 
cfsearch 
cfstoredproc

ColdFusion query variables

A ColdFusion tag that returns a query object supports the following variables, where queryname is the value of the name attribute:

queryname.CurrentRow 
queryname.RecordCount 
queryname.ColumnList

CFCATCH variables

Within a cfcatch block, the active exception properties can be accessed as the following variables:

CFCATCH.Type 
CFCATCH.Message 
CFCATCH.Detail 
CFCATCH.ErrNumber 
CFCATCH.NativeErrorCode 
CFCATCH.SQLState 
CFCATCH.LockName 
CFCATCH.LockOperation 
CFCATCH.MissingFileName 
CFCATCH.TagContext 
CFCATCH.ErrorCode 
CFCATCH.ExtendedInfo

Within a cfcatch block, database exception properties can be accessed as the following variables:

CFCATCH.QueryError 
CFCATCH.SQL 
CFCATCH.Where 
CFCATCH.Datasource

Within a cfcatch block, undefined variable exception properties can be accessed as the following variable:

CFCATCH.Name

Within a cfcatch block, syntax and parsing exception properties can be accessed as the following variables:

CFCATCH.TokenText 
CFCATCH.Snippet 
CFCATCH.Column 
CFCATCH.KnownColumn 
CFCATCH.Line 
CFCATCH.KnownLine

CFDIRECTORY variables

The cfdirectory tag, with action=list, returns a query object as follows, where queryname is the name attribute value:

queryname.Name 
queryname.Size 
queryname.Type 
queryname.DateLastModified 
queryname.Attributes 
queryname.Mode

CFERROR variables

When cferror generates an error page, the following error variables are available if type="request" or "exception".

Error.Diagnostics 
Error.MailTo 
Error.DateTime 
Error.Browser 
Error.GeneratedContent 
Error.RemoteAddress 
Error.HTTPReferer 
Error.Template 
Error.QueryString

The following error variables are available if type="validation".

Error.ValidationHeader  
Error.InvalidFields  
Error.ValidationFooter 

Any cfcatch variable that applies to exception type can be accessed within the Error scope, as follows:

Error.Type 
Error.Message 
Error.Detail 
Error.ErrNumber 
Error.NativeErrorCode 
Error.SQLState 
Error.LockName 
Error.LockOperation 
Error.MissingFileName 
Error.TagContext 
Error.ErrorCode 
Error.ExtendedInfo
Note: You can substitute the prefix CFERROR for Error, if type = "Exception"; for example, CFERROR.Diagnostics, CFERROR.Mailto, or CFERROR.DateTime.

CFFILE ACTION=Upload variables

File variables are read-only. Use the CFFILE prefix to reference file variables, for example, CFFILE.ClientDirectory. The File prefix is deprecated in favor of the CFFILE prefix.

CFFILE.AttemptedServerFile 
CFFILE.ClientDirectory 
CFFILE.ClientFile 
CFFILE.ClientFileExt 
CFFILE.ClientFileName 
CFFILE.ContentSubType 
CFFILE.ContentType 
CFFILE.DateLastAccessed 
CFFILE.FileExisted 
CFFILE.FileSize 
CFFILE.FileWasAppended 
CFFILE.FileWasOverwritten 
CFFILE.FileWasRenamed 
CFFILE.FileWasSaved 
CFFILE.OldFileSize 
CFFILE.ServerDirectory 
CFFILE.ServerFile 
CFFILE.ServerFileExt 
CFFILE.ServerFileName 
CFFILE.TimeCreated 
CFFILE.TimeLastModified

CFFTP error variables

When you use the cfftp stoponerror attribute, the following variables are populated:

CFFTP.Succeeded 
CFFTP.ErrorCode 
CFFTP.ErrorText

CFFTP ReturnValue variable

Some cfftp file and directory operations provide a return value, in the variable CFFTP.ReturnValue. Its value is determined by the results of the action attribute. When you specify any of the following actions, cfftp returns a value:

GetCurrentDir 
GetCurrentURL 
ExistsDir 
ExistsFile 
Exists

CFFTP query object columns

When you use the cfftp tag with the listdir action, cfftp returns a query object, where queryname is the name attribute value, and row is the row number of each file or directory entry:

queryname.Name[row] 
queryname.Path[row] 
queryname.URL[row] 
queryname.Length[row] 
queryname.LastModified[row] 
queryname.Attributes 
queryname.IsDirectory 
queryname.Mode

CFHTTP variables

A cfhttp get operation can return text and binary files. Files are downloaded and the contents stored in a variable or file, depending on the MIME type, as follows:

CFHTTP.FileContent 
CFHTTP.MimeType 
CFHTTP.Header 
CFHTTP.ResponseHeader[http_hd_key] 
CFHTTP.StatusCode

CFLDAP variables

The cfldapaction=query tag returns information about the LDAP query, as follows:

queryname.CurrentRow 
queryname.RecordCount 
queryname.ColumnList

CFPOP variables

The cfpop tag returns the following result columns, depending on the action attribute value and the use of other attributes, such as attachmentpath, where queryname is the name attribute value:

queryname.Date 
queryname.From 
queryname.Body 
queryname.Header 
queryname.MessageNumber 
queryname.ReplyTo 
queryname.Subject 
queryname.CC 
queryname.To 
queryname.CurrentRow 
queryname.RecordCount 
queryname.ColumnList 
queryname.Attachments 
queryname.AttachmentFiles

CFQUERY and CFSTOREDPROC variables

The cfquery tag returns information about the query in this variable:

CFQUERY.ExecutionTime 

The cfquery tag uses the query name to scope the following data about the query:

queryname.CurrentRow 
queryname.RecordCount 
queryname.ColumnList

The cfstoredproc tag returns the following variables:

CFSTOREDPROC.ExecutionTime 
CFSTOREDPROC.StatusCode

CFREGISTRY variables

The cfregistry tag returns a query record set that you can reference after executing the GetAll action, as follows, where queryname is the name attribute value:

queryname.Entry 
queryname.Type 
queryname.Value

CFSEARCH variables

A cfsearch operation returns the following variables, where searchname is the name attribute value:

searchname.URL 
searchname.Key 
searchname.Title 
searchname.Score 
searchname.Custom1 and Custom2 
searchname.Summary 
searchname.RecordCount 
searchname.CurrentRow 
searchname.RecordsSearched 
searchname.ColumnList