- CFML Reference User Guide
- ColdFusion functions
- ColdFusion functions by category
- Functions a-b
- Abs
- ACos
- AddSOAPRequestHeader
- AddSOAPResponseHeader
- AjaxLink
- AjaxOnLoad
- ApplicationStop
- ArrayAppend
- ArrayAvg
- ArrayClear
- ArrayContains
- ArrayContainsNoCase
- ArrayDelete
- ArrayDeleteAt
- ArrayDeleteNoCase
- ArrayEach
- ArrayFilter
- ArrayFind
- ArrayFindAll
- ArrayFindAllNoCase
- ArrayFindNoCase
- ArrayInsertAt
- ArrayIsDefined
- ArrayIsEmpty
- ArrayLen
- ArrayMap
- ArrayMax
- ArrayMin
- ArrayNew
- ArrayPrepend
- ArrayReduce
- ArrayResize
- ArraySet
- ArraySetMetadata
- ArraySlice
- ArraySort
- ArraySum
- ArraySwap
- ArrayToList
- Asc
- ASin
- Atn
- AuthenticatedContext
- AuthenticatedUser
- BinaryDecode
- BinaryEncode
- BitAnd
- BitMaskClear
- BitMaskRead
- BitMaskSet
- BitNot
- BitOr
- BitSHLN
- BitSHRN
- BitXor
- BooleanFormat
- Abs
- Functions-c-d
- CacheGet
- CacheGetAllIds
- CacheGetMetadata
- CacheGetProperties
- CacheGetSession
- CacheIdExists
- CachePut
- CacheRegionExists
- CacheRegionNew
- CacheRegionRemove
- CacheRemove
- CacheRemoveAll
- CacheSetProperties
- CallStackDump
- CallStackGet
- CanDeSerialize
- Canonicalize
- CanSerialize
- Ceiling
- CharsetDecode
- CharsetEncode
- Chr
- CJustify
- Compare
- CompareNoCase
- Cos
- CreateDate
- CreateDateTime
- CreateObject
- CreateObject: .NET object
- CreateObject: COM object
- CreateObject: component object
- CreateObject: CORBA object
- CreateObject: Java or EJB object
- CreateObject: web service object
- CreateODBCDate
- CreateODBCDateTime
- CreateODBCTime
- CreateSignedJWT
- CreateEncryptedJWT
- CreateTime
- CreateTimeSpan
- CreateUUID
- CSRFGenerateToken
- CSRFVerifyToken
- CSVRead
- CSVWrite
- CSVProcess
- DateAdd
- DateCompare
- DateConvert
- DateDiff
- DateFormat
- DatePart
- DateTimeFormat
- Day
- DayOfWeek
- DayOfWeekAsString
- DayOfYear
- DaysInMonth
- DaysInYear
- DE
- DecimalFormat
- DecodeForHTML
- DecodeFromURL
- DecrementValue
- Decrypt
- DecryptBinary
- DeleteClientVariable
- Deserialize
- DeserializeJSON
- DeserializeXML
- DirectoryCopy
- DirectoryCreate
- DirectoryDelete
- DirectoryExists
- DirectoryList
- DirectoryRename
- DollarFormat
- DotNetToCFType
- Duplicate
- Functions-e-g
- EncodeForCSS
- EncodeForDN
- EncodeForHTML
- EncodeForHTMLAttribute
- EncodeForJavaScript
- EncodeForLDAP
- EncodeForURL
- EncodeForXML
- EncodeForXMLAttribute
- EncodeForXpath
- Encrypt
- EncryptBinary
- EntityDelete
- EntityLoad
- EntityLoadByExample
- EntityLoadByPK
- EntityMerge
- EntityNew
- EntityReload
- EntitySave
- EntityToQuery
- Evaluate
- Exp
- ExpandPath
- FileClose
- FileCopy
- FileDelete
- FileExists
- FileGetMimeType
- FileIsEOF
- FileMove
- FileOpen
- FileRead
- FileReadBinary
- FileReadLine
- FileSeek
- FileSetAccessMode
- FileSetAttribute
- FileSetLastModified
- FileSkipBytes
- FileUpload
- FileUploadAll
- FileWrite
- FileWriteLine
- Find
- FindNoCase
- FindOneOf
- FirstDayOfMonth
- Fix
- Floor
- FormatBaseN
- GeneratePBKDFKey
- GenerateSecretKey
- GetApplicationMetadata
- GetAuthUser
- GetBaseTagData
- GetBaseTagList
- GetBaseTemplatePath
- GetClientVariablesList
- GetComponentMetaData
- GetContextRoot
- GetCPUUsage
- GetCurrentTemplatePath
- GetCSPNonce
- GetDirectoryFromPath
- GetEncoding
- GetException
- GetFileFromPath
- GetFileInfo
- GetFreeSpace
- GetFunctionCalledName
- GetFunctionList
- GetGatewayHelper
- GetHttpRequestData
- GetHttpTimeString
- GetK2ServerDocCount
- GetK2ServerDocCountLimit
- GetLocale
- GetLocaleDisplayName
- GetLocalHostIP
- GetMetaData
- GetMetricData
- GetPageContext
- GetPropertyString
- GetPropertyFile
- GetPrinterInfo
- GetPrinterList
- GetProfileSections
- GetProfileString
- GetReadableImageFormats
- GetSafeHTML
- GetSAMLAuthRequest
- GetSAMLLogoutRequest
- Generate3DesKey
- GenerateSAMLSPMetadata
- GetSOAPRequest
- GetSOAPRequestHeader
- GetSOAPResponse
- GetSOAPResponseHeader
- GetSystemFreeMemory
- GetSystemTotalMemory
- GetTempDirectory
- GetTempFile
- GetTemplatePath
- GetTickCount
- GetTimeZoneInfo
- GetToken
- GetTotalSpace
- GetUserRoles
- GetVFSMetaData
- GetWriteableImageFormats
- Functions-h-im
- Hash
- HMac
- Hour
- HQLMethods
- HTMLCodeFormat
- HTMLEditFormat
- IIf
- ImageAddBorder
- ImageBlur
- ImageClearRect
- ImageCopy
- ImageCreateCaptcha
- ImageCrop
- ImageDrawArc
- ImageDrawBeveledRect
- ImageDrawCubicCurve
- ImageDrawLine
- ImageDrawLines
- ImageDrawOval
- ImageDrawPoint
- ImageDrawQuadraticCurve
- ImageDrawRect
- ImageDrawRoundRect
- ImageDrawText
- ImageFlip
- ImageGetBlob
- ImageGetBufferedImage
- ImageGetEXIFMetadata
- ImageGetEXIFTag
- ImageGetHeight
- ImageGetIPTCMetadata
- ImageGetIPTCTag
- ImageGetMetadata
- ImageGetWidth
- ImageGrayscale
- ImageInfo
- ImageMakeColorTransparent
- ImageMakeTranslucent
- ImageNegative
- ImageNew
- ImageOverlay
- ImagePaste
- ImageRead
- ImageReadBase64
- ImageResize
- ImageRotate
- ImageRotateDrawingAxis
- ImageScaleToFit
- ImageSetAntialiasing
- ImageSetBackgroundColor
- ImageSetDrawingColor
- ImageSetDrawingStroke
- ImageSetDrawingTransparency
- ImageSharpen
- ImageShear
- ImageShearDrawingAxis
- ImageTranslate
- ImageTranslateDrawingAxis
- ImageWrite
- ImageWriteBase64
- ImageXORDrawingMode
- Functions-in-k
- IncrementValue
- InputBaseN
- Insert
- Int
- InterruptThread
- InvalidateOauthAccesstoken
- Invoke
- InitSAMLAuthRequest
- InitSAMLLogoutRequest
- InvokeCFClientFunction
- IsArray
- IsAuthenticated
- IsAuthorized
- IsBinary
- IsBoolean
- IsClosure
- IsCustomFunction
- IsDate
- IsDateObject
- IsDDX
- IsDebugMode
- IsDefined
- IsImage
- IsImageFile
- IsInstanceOf
- IsIPv6
- IsJSON
- IsK2ServerABroker
- IsK2ServerDocCountExceeded
- IsK2ServerOnline
- IsLeapYear
- IsLocalHost
- IsNull
- IsNumeric
- IsNumericDate
- IsObject
- isOnline
- IsPDFArchive
- IsPDFFile
- IsPDFObject
- IsProtected
- IsQuery
- isSamlLogoutResponse
- isSafeHTML
- IsSimpleValue
- IsSOAPRequest
- IsSpreadsheetFile
- IsSpreadsheetObject
- IsStruct
- isThreadInterrupted
- IsUserInAnyRole
- IsUserInRole
- IsUserLoggedIn
- IsValid
- IsValidOauthAccesstoken
- IsWDDX
- IsXML
- IsXmlAttribute
- IsXmlDoc
- IsXmlElem
- IsXmlNode
- IsXmlRoot
- JavaCast
- JSStringFormat
- Functions-l
- LCase
- Left
- Len
- ListAppend
- ListChangeDelims
- ListContains
- ListContainsNoCase
- ListDeleteAt
- ListEach
- ListFilter
- ListFind
- ListFindNoCase
- ListFirst
- ListGetAt
- ListGetDuplicates
- ListInsertAt
- ListLast
- ListLen
- ListMap
- ListPrepend
- ListQualify
- ListReduce
- ListRemoveDuplicates
- ListRest
- ListSetAt
- ListSort
- ListToArray
- ListValueCount
- ListValueCountNoCase
- LJustify
- Location
- Log
- Log10
- LSCurrencyFormat
- LSDateFormat
- LSDateTimeFormat
- LSEuroCurrencyFormat
- LSIsCurrency
- LSIsDate
- LSIsNumeric
- LSNumberFormat
- LSParseCurrency
- LSParseDateTime
- LSParseEuroCurrency
- LSParseNumber
- LSTimeFormat
- LTrim
- Functions-m-r
- Max
- Mid
- Min
- Minute
- Month
- MonthAsString
- Now
- NumberFormat
- ObjectEquals
- ObjectLoad
- ObjectSave
- OnWSAuthenticate
- ORMClearSession
- ORMCloseAllSessions
- ORMCloseSession
- ORMEvictCollection
- ORMEvictEntity
- ORMEvictQueries
- ORMExecuteQuery
- ORMFlush
- ORMFlushall
- ORMGetSession
- ORMGetSessionFactory
- ORMIndex
- ORMIndexPurge
- ORMReload
- ORMSearch
- ORMSearchOffline
- ParagraphFormat
- ParameterExists
- ParseDateTime
- Pi
- PrecisionEvaluate
- ProcessSAMLResponse
- ProcessSAMLLogoutRequest
- Quarter
- PreserveSingleQuotes
- QueryAddColumn
- QueryAddRow
- QueryConvertForGrid
- QueryExecute
- QueryFilter
- QueryGetResult
- QueryGetRow
- QueryKeyExists
- QueryMap
- QueryNew
- QueryReduce
- QuerySetCell
- QuotedValueList
- QueryEach
- Rand
- Randomize
- RandRange
- ReEscape
- REFind
- REFindNoCase
- ReleaseComObject
- REMatch
- REMatchNoCase
- RemoveCachedQuery
- RemoveChars
- RepeatString
- Replace
- ReplaceList
- ReplaceNoCase
- REReplace
- REReplaceNoCase
- RestDeleteApplication
- RestSetResponse
- RestInitApplication
- Reverse
- Right
- RJustify
- Round
- RTrim
- Functions-s
- Second
- SendGatewayMessage
- SendSAMLLogoutResponse
- Serialize
- SerializeJSON
- SerializeXML
- SessionInvalidate
- SessionRotate
- SessionGetMetaData
- SessionInvalidate
- SessionRotate
- SetDay
- SetEncoding
- SetHour
- SetLocale
- SetMonth
- SetProfileString
- SetPropertyString
- SetVariable
- SetYear
- Sgn
- Sin
- Sleep
- SpanExcluding
- SpanIncluding
- SpreadsheetAddAutoFilter
- SpreadsheetAddColumn
- SpreadsheetAddFreezePane
- SpreadsheetAddImage
- SpreadsheetAddInfo
- SpreadsheetAddPageBreaks
- SpreadsheetAddRow
- SpreadsheetAddRows
- SpreadsheetAddSplitPane
- SpreadsheetCreateSheet
- SpreadsheetDeleteColumn
- SpreadsheetDeleteColumns
- SpreadsheetDeleteRow
- SpreadsheetDeleteRows
- SpreadsheetFormatCell
- SpreadsheetFormatColumn
- SpreadsheetFormatCellRange
- SpreadsheetFormatColumn
- SpreadsheetFormatColumns
- SpreadsheetFormatRow
- SpreadsheetFormatRows
- SpreadsheetGetCellComment
- SpreadsheetGetCellFormula
- SpreadsheetGetCellValue
- SpreadsheetGetColumnCount
- SpreadsheetInfo
- SpreadsheetMergeCells
- SpreadsheetNew
- SpreadsheetRead
- SpreadsheetReadBinary
- SpreadsheetRemoveSheet
- SpreadsheetSetActiveSheet
- SpreadsheetSetActiveSheetNumber
- SpreadsheetSetCellComment
- SpreadsheetSetCellFormula
- SpreadsheetSetCellValue
- SpreadsheetSetColumnWidth
- SpreadsheetSetFooter
- SpreadsheetSetHeader
- SpreadsheetSetRowHeight
- SpreadsheetShiftColumns
- SpreadsheetShiftRows
- SpreadsheetWrite
- StreamingSpreadsheetNew
- StreamingSpreadsheetCleanup
- StreamingSpreadsheetRead
- StreamingSpreadsheetProcess
- SpreadsheetSetFooterImage
- SpreadsheetSetHeaderImage
- SpreadsheetSetFittoPage
- SpreadsheetUngroupColumns
- SpreadsheetGroupColumns
- SpreadsheetUngroupRows
- SpreadsheetGroupRows
- SpreadsheetRemoveColumnBreak
- SpreadsheetSetColumnBreak
- SpreadsheetRemoveRowBreak
- SpreadsheetSetRowBreak
- SpreadsheetRemovePrintGridlines
- SpreadsheetAddPrintGridlines
- SpreadsheetGetColumnWidth
- SpreadsheetSetColumnHidden
- SpreadsheetSetRowHidden
- SpreadsheetisColumnHidden
- SpreadsheetisRowHidden
- SpreadsheetisStreamingXmlFormat
- SpreadsheetisXmlFormat
- SpreadsheetisBinaryFormat
- SpreadsheetRenameSheet
- SpreadsheetRemoveSheetNumber
- SpreadsheetGetLastRowNumber
- SpreadsheetGetPrintOrientation
- Sqr
- StripCR
- StructAppend
- StructClear
- StructCopy
- StructCount
- StructDelete
- StructEach
- StructFilter
- StructFind
- StructFindKey
- StructFindValue
- StructGet
- StructGetMetadata
- StructInsert
- StructIsEmpty
- StructKeyArray
- StructKeyExists
- StructKeyList
- StructMap
- StructNew
- StructReduce
- StructSetMetadata
- StructSort
- StructToSorted
- StructUpdate
- StructValueArray
- StoreSetMetadata
- StoreGetACL
- StoreGetMetadata
- StoreAddACL
- StoreSetACL
- Functions-t-z
- Tan
- ThreadJoin
- ThreadTerminate
- Throw
- TimeFormat
- ToBase64
- ToBinary
- ToScript
- ToString
- Trace
- Transactionandconcurrency
- TransactionCommit
- TransactionRollback
- TransactionSetSavePoint
- Trim
- UCase
- URLDecode
- URLEncodedFormat
- URLSessionFormat
- Val
- ValueList
- VerifyClient
- Week
- Wrap
- WriteDump
- WriteLog
- WriteOutput
- WSGetAllChannels
- WSGetSubscribers
- WSPublish
- WSSendMessage
- XmlChildPos
- XmlElemNew
- XmlFormat
- XmlGetNodeType
- XmlNew
- XmlParse
- XmlSearch
- XmlTransform
- XmlValidate
- Year
- YesNoFormat
- ColdFusion tags
- ColdFusion tag summary
- ColdFusion tags by category
- Application framework tags
- Communications tags
- Database manipulation tags
- Data output tags
- Debugging tags
- Exception handling tags
- Extensibility tags
- File management tags
- Flow-control tags
- Forms tags
- Internet Protocol tags
- Page processing tags
- Security tags
- Variable manipulation tags
- Other tags
- Tags a-b
- Tags c
- cfcache
- cfcalendar
- cfcase
- cfcatch
- cfchart
- cfchart tag in ColdFusion
- Get started with cfchart
- Customize a chart using cfchart
- Advanced cfchart customization options
- Create an area chart in ColdFusion
- Create line charts in ColdFusion
- Create bar charts in ColdFusion
- Create floating bar charts in ColdFusion
- Create histograms in ColdFusion
- Create pie charts in ColdFusion
- Create funnel charts in ColdFusion
- Create pyramid charts in ColdFusion
- Create curve charts in ColdFusion
- Create boxplots in ColdFusion
- Create donut charts in ColdFusion
- Create bubble charts in ColdFusion
- Create scatterplots in ColdFusion
- Create radar charts in ColdFusion
- Other chart types in ColdFusion (Cone, Cylinder, Piano, and Bullet)
- Advanced customization options in cfchart
- cfchartdata
- cfchartseries
- cfchartset
- cfclient
- cfclientsettings
- cfcol
- cfcollection
- cfcomponent
- cfcontent
- cfcontinue
- cfcookie
- Tags f
- cffeed
- cffile
- cffile action = "append"
- cffile action = "copy"
- cffile action = "delete"
- cffile action = "move"
- cffile action = "read"
- cffile action = "readBinary"
- cffile action = "rename"
- cffile action = "upload"
- cffile action = "uploadAll"
- cffile action = "write"
- cffileupload
- cffinally
- cfflush
- cfform
- cfformgroup
- cfformitem
- cfftp
- cfftp: Connection: file and directory operations
- cfftp: Opening and closing FTP server connections
- cfftp : Opening and closing secure FTP server connections
- cfftp action = "listDir"
- cffunction
- Tags g-h
- Tags i
- Tags j-l
- cfjava
- cflayout
- cflayoutarea
- cfldap
- cflocation
- cflock
- cflog
- cflogin
- cfloginuser
- cflogout
- cfloop
- cfloop : conditional loop
- cfloop : index loop
- cfloop : looping over a COM collection or structure
- cfloop : looping over a date or time range
- cfloop : looping over a list, a file, or an array
- cfloop : looping over a query
- Tags m-o
- cfmail
- cfmailparam
- cfmailpart
- cfmap
- cfmapitem
- cfmediaplayer
- cfmenu
- cfmenuitem
- cfmessagebox
- cfmodule
- cfNTauthenticate
- cfoauth
- cfobject
- cfobject: .NET object
- cfobject: COM object
- cfobject: component object
- cfobject: CORBA object
- cfobject: Java or EJB object
- cfobject: web service object
- cfobjectcache
- cfoutput
- Tags p-q
- Tags r-s
- Tags t
- Tags u-z
- CFML Reference
- Reserved words and variables
- Ajax JavaScript functions
- Ajax JavaScript functions
- Function summary Ajax
- ColdFusion.Ajax.submitForm
- ColdFusion.Autosuggest.getAutosuggestObject
- ColdFusion.Layout.enableSourceBind
- ColdFusion.MessageBox.getMessageBoxObject
- ColdFusion.ProgressBar.getProgressBarObject
- ColdFusion.MessageBox.isMessageBoxDefined
- JavaScriptFunctionsinColdFusion9Update1
- ColdFusion ActionScript functions
- ColdFusion mobile functions
- Application.cfc reference
- Script functions implemented as CFCs
- ColdFusion Flash Form style reference
- Styles valid for all controls
- Styles for cfform
- Styles for cfformgroup with horizontal or vertical type attributes
- Styles for box-style cfformgroup elements
- Styles for cfformgroup with accordion type attribute
- Styles for cfformgroup with tabnavigator type attribute
- Styles for cfformitem with hrule or vrule type attributes
- Styles for cfinput with radio, checkbox, button, image, or submit type attributes
- Styles for cftextarea tag and cfinput with text, password, or hidden type attributes
- Styles for cfselect with size attribute value of 1
- Styles for cfselect with size attribute value greater than 1
- Styles for cfcalendar tag and cfinput with dateField type attribute
- Styles for the cfgrid tag
- Styles for the cftree tag
- ColdFusion Flash Form Style Reference
- ColdFusion event gateway reference
- ColdFusion Event Gateway reference
- addEvent
- CFEvent
- CFEventclass
- Constructor
- Gateway development interfaces and classes
- getStatus
- setCFCPath
- setCFCMethod
- getOriginatorID
- getLogger
- getBuddyList
- getBuddyInfo
- IM gateway message sending commands
- IM Gateway GatewayHelper class methods
- onIncomingMessage
- onIMServerMessage
- onBuddyStatus
- onAddBuddyResponse
- onAddBuddyRequest
- IM Gateway CFC incoming message methods
- IM gateway methods and commands
- CFML CFEvent structure
- warn
- info
- setOriginatorID
- data command
- submit Multi command
- submit command
- setGatewayType
- setGatewayID
- setData
- setCFCListeners
- outgoingMessage
- getStatusTimeStamp
- numberOfMessagesReceived
- numberOfMessagesSent
- removeBuddy
- removeDeny
- removePermit
- setNickName
- setPermitMode
- setStatus
- SMS Gateway CFEvent structure and commands
- SMS Gateway incoming message CFEvent structure
- getStatusAsString
- getProtocolName
- getPermitMode
- getPermitList
- getNickName
- getName
- getDenyList
- getCustomAwayMessage
- getQueueSize
- getMaxQueueSize
- getHelper
- getGatewayType
- getGatewayServices
- getGatewayID_1
- getGatewayID
- getData
- getCFCTimeout
- setCFCTimeout
- getCFCPath
- getCFCMethod
- GatewayServices class
- Gateway interface
- GatewayHelper interface
- addPermit
- addDeny
- addBuddy
- error
- debug
- Logger class
- stop
- start
- CFML event gateway SendGatewayMessage data parameter
- restart
- fatal
- SMS gateway message sending commands
- ColdFusion C++ CFX Reference
- ColdFusion Java CFX reference
- WDDX JavaScript Objects
- Cloud services
- ColdFusion and GCP Storage
- ColdFusion and GCP Firestore
- ColdFusion and GCP PubSub
- ColdFusion and Amazon S3
- ColdFusion and DynamoDB
- ColdFusion and Amazon SQS
- ColdFusion and Amazon SNS
- ColdFusion and MongoDB
- ColdFusion and Azure Blob
- ColdFusion and Azure Service Bus
- Multi-cloud storage services
- Multi-cloud RDS databases
- ColdFusion and Azure Cosmos DB
Description
Use the cfdump tag to get the elements, variables, and values of most kinds of ColdFusion objects. Useful for debugging. You can display the contents of simple and complex variables, objects, components, user-defined functions, and other elements. The cfdump now shows component properties defined by cfproperty when you dump a CFC. A new key called PROPERTIES has been added in the component dump, which is expanded, by default. The text format of cfdump also provides this information.
Category
Debugging tags, Variable manipulation tags
Syntax
<cfdump var = "#variable#" output = "browser|console|file" format = "text|html" abort = "true|false"> label = "text" metainfo = "yes|no" top = "number of rows|number of levels" show = "columns|keys" hide = "columns|keys" keys = "number of keys to display for structures" expand = "yes|no" showUDFs = "yes|no">
Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. |
See also
cfcookie, cfparam, cfsavecontent, cfschedule, cfset, cftimer, cfwddx
History
- ColdFusion (2025 release): Displays additional details in the output, such as, methods in a Java class, constructors, which lists all the constructors for the class showing the method and the declared exceptions that can be thrown, Methods inherited from <parent object>, and the list of methods includes the exceptions that can be thrown. See the examples for more imformation.
- ColdFusion 9: Added the attribute abort.
- ColdFusion 8: Added the show, format, hide, keys, metainfo, output, and showUDFs attributes.
- ColdFusion MX 7: Added the top attribute.
- ColdFusion MX 6.1: Added the ability to dump COM objects; it displays the methods and Get and Put properties typeinfo information for the object.
Attributes
Attribute |
Req/Opt |
Default |
Description |
|---|---|---|---|
var |
Required |
|
Variable to display. Enclose a variable name in number signs. These kinds of variables yield meaningful cfdump output:
|
expand |
Optional |
yes |
|
format |
Optional |
text |
Use with the output attribute to specify whether to save the results of a cfdump to a file in text or HTML format. |
hide |
Optional |
all |
For a query, this is a column name or a comma-delimited list of column names. For a structure, this is a key or a comma-delimited list of keys. |
keys |
Optional |
9999 |
For a structure, the number of keys to display. |
label |
Optional |
|
A string; header for the dump output. Ignored if the value of the var attribute is a simple types. |
metainfo |
Optional |
yes for query{{no}} for persistence CFCs |
For use with queries and persistence CFCs. Includes information about the query in the cfdump results, including whether the query was cached, the execution time, and the SQL. Specify metainfo="no" to exclude this information from the query result. For persistence CFCs, if metainfo="yes", returns property attributes such as getters and setters. |
output |
Optional |
browser |
Where to send the results of cfdump. The following values are valid:
|
show |
Optional |
all |
For a query, this is a column name or a comma-delimited list of column names. For a structure, this is a key or a comma-delimited list of keys. |
showUDFs |
Optional |
yes |
|
top |
Optional |
9999 |
The number of rows to display. For a structure, this is the number of nested levels to display. |
abort |
Optional |
false |
If this attribute is set to "true", it stops processing the current page at the tag location. |
Usage
The expand/contract display capability is useful when working with large structures, such as XML document objects, structures, and arrays.
To display a construct, use code such as the following, in which myDoc is a variable of type XmlDocument:
<cfif IsXmlDoc(mydoc) is "yes"> |
The tag output is color-coded according to data type.
If a table cell is empty, this tag displays "empty string".
Example
<!--- This example shows how to use this tag to display the CGI scope as a structure: --->
<cfdump var="#cgi#"><!--- This displays information about file objects. --->
<cfscript>
myfile = FileOpen("c:\temp\test1.txt", "read");
</cfscript>
myfile refers to:
<cfdump var="#myfile.filepath#">
Examples
<!--- class name ---> <cfset boolVal = true> <cfdump var ="#boolVal.getClass()#">
<cfset obj = createObject("java", "java.io.File")>
<cfdump var="#obj#" >
<cfscript>
nestedArr = [[1, 2, 3], ["a", "b", "c"], [true, false]];
writedump(var="#nestedArr.getClass()#");
</cfscript>
The script creates a nested array and dumps its Java class details using getClass(). The updated cfdump now shows additional details like methods, constructors, inherited methods, and exceptions.
Real-world uses of the cfdump tag
Debugging API responses
Your e-commerce company integrates with a payment gateway API to process customer transactions. Recently, some payments have been failing, but the error messages are unclear. You need to inspect the complete API response to understand what data is being returned and identify the issue.
Problem statement
- Payment processing occasionally fails without clear error messages
- Need to see the full structure of API responses
- Must identify which fields are missing or malformed
- Time-sensitive issue affecting customer checkout experience
Use cfdump to display the complete API response structure, including all nested objects, arrays, and properties. This allows you to:
- See exactly what data the API is returning
- Identify missing or unexpected fields
- Understand the structure of error responses
- Compare successful vs. failed responses
<cfscript>
// Simulate calling a payment gateway API
function processPayment(amount, cardNumber) {
// In real scenario, this would be an actual API call
// Example: result = httpService.post(paymentGatewayURL, paymentData);
var apiResponse = {
"status": "error",
"transaction_id": "TXN-" & createUUID(),
"amount": amount,
"currency": "USD",
"timestamp": now(),
"error": {
"code": "INVALID_CARD",
"message": "Card number validation failed",
"details": {
"field": "card_number",
"reason": "Invalid checksum"
}
},
"metadata": {
"processor": "StripeGateway",
"api_version": "2023.1",
"request_id": "req_" & randRange(10000, 99999)
}
};
return apiResponse;
}
// Process a payment
paymentResult = processPayment(99.99, "4111111111111111");
</cfscript>
<h2>Payment API Response Debugger</h2>
<!--- Use cfdump to display the complete API response structure --->
<cfdump
var="#paymentResult#"
label="Payment Gateway API Response"
expand="yes">
<!--- For production environments, output to a log file instead --->
<cfif isDefined("url.debug") AND url.debug EQ "logfile">
<cfdump
var="#paymentResult#"
output="#getTempDirectory()#payment-debug.html"
format="html"
label="Payment Debug Log - #dateFormat(now(), 'yyyy-mm-dd')# #timeFormat(now(), 'HH:mm:ss')#">
<p>Debug information saved to: #getTempDirectory()#payment-debug.html</p>
</cfif>
<!--- Display specific error information if present --->
<cfif structKeyExists(paymentResult, "error")>
<h3>Error Details:</h3>
<cfdump
var="#paymentResult.error#"
label="Error Object"
expand="yes">
</cfif>
Database query inspection
Your customer support application runs a complex SQL query to retrieve customer order history. The query joins multiple tables and includes calculated fields. Team members report that some customers see incomplete data, and query performance seems slow.
Problem statement
- Complex queries with multiple joins and calculations
- Inconsistent results for certain customers
- Need to verify what data is actually being returned
- Must check query execution time and metadata
- SQL logic needs validation before optimization
Solution
Use cfdump with the metainfo attribute to display both the query results and execution details.
<cfscript>
// Simulate a complex customer order query
// In real scenario, this would query your actual database
customerOrderQuery = queryNew(
"orderID,customerName,orderDate,productName,quantity,unitPrice,totalAmount,status",
"integer,varchar,date,varchar,integer,decimal,decimal,varchar"
);
queryAddRow(customerOrderQuery, [
{
orderID: 1001,
customerName: "John Smith",
orderDate: dateAdd("d", -5, now()),
productName: "Laptop Computer",
quantity: 1,
unitPrice: 1299.99,
totalAmount: 1299.99,
status: "Shipped"
},
{
orderID: 1002,
customerName: "John Smith",
orderDate: dateAdd("d", -3, now()),
productName: "Wireless Mouse",
quantity: 2,
unitPrice: 29.99,
totalAmount: 59.98,
status: "Delivered"
},
{
orderID: 1003,
customerName: "John Smith",
orderDate: now(),
productName: "USB Cable",
quantity: 3,
unitPrice: 9.99,
totalAmount: 29.97,
status: "Processing"
}
]);
</cfscript>
<h2>Customer Order History - Debug View</h2>
<!--- Display complete query with metadata --->
<cfdump
var="#customerOrderQuery#"
label="Customer Order Query Results"
metainfo="yes"
expand="yes">
<hr>
<!--- Show only specific columns --->
<h3>Simplified View (Selected Columns Only)</h3>
<cfdump
var="#customerOrderQuery#"
label="Order Summary"
show="orderID,orderDate,productName,totalAmount,status"
top="10">
<hr>
<!--- Hide sensitive columns --->
<h3>Customer Service View (Sensitive Data Hidden)</h3>
<cfdump
var="#customerOrderQuery#"
label="Orders (Public View)"
hide="unitPrice,customerName">
<!--- Output to console for server-side debugging --->
<cfif isDefined("url.debug") AND url.debug EQ "console">
<cfdump
var="#customerOrderQuery#"
output="console"
label="Query Console Debug">
<p>Query data sent to console (check ColdFusion logs)</p>
</cfif>
<!--- Display query statistics --->
<cfscript>
queryStats = {
"totalRecords": customerOrderQuery.recordCount,
"totalOrderValue": dollarFormat(arraySum(customerOrderQuery["totalAmount"])),
"averageOrderValue": dollarFormat(arrayAvg(customerOrderQuery["totalAmount"])),
"columnList": customerOrderQuery.columnList
};
</cfscript>
<h3>Query Statistics</h3>
<cfdump var="#queryStats#" label="Summary Stats">
Session data debugging
Your web application uses session variables to track user authentication, preferences, shopping cart contents, and navigation history. Users are reporting that they're being logged out unexpectedly, and shopping cart items are disappearing. You need to inspect the session scope to understand what's happening.
Problem statement
- Users experiencing unexpected logouts
- Session data seems to be lost or corrupted
- Shopping cart losing items between pages
- Need to verify session structure and contents
- Must track session state across requests
- Difficult to see nested session objects
Solution
Use cfdump to display the entire session scope or specific session variables.
<cfscript>
// Initialize session data (simulating a real user session)
session.user = {
"userID": 12345,
"username": "jsmith@example.com",
"firstName": "John",
"lastName": "Smith",
"role": "customer",
"loginTime": now(),
"lastActivity": now(),
"isAuthenticated": true,
"preferences": {
"theme": "dark",
"language": "en",
"notifications": true,
"currency": "USD"
}
};
session.shoppingCart = {
"cartID": "CART-" & createUUID(),
"items": [
{
"productID": 501,
"name": "Wireless Keyboard",
"quantity": 1,
"price": 79.99
},
{
"productID": 502,
"name": "Monitor Stand",
"quantity": 2,
"price": 45.00
}
],
"subtotal": 169.99,
"tax": 13.60,
"total": 183.59,
"createdAt": dateAdd("h", -2, now()),
"lastUpdated": now()
};
session.navigation = {
"currentPage": getCurrentTemplatePath(),
"previousPage": "/products/index.cfm",
"pageHistory": ["home", "products", "cart"],
"visitCount": 5
};
</cfscript>
<!--- Security check: Only show in development mode --->
<cfif isDefined("application.environment") AND application.environment EQ "development">
<h2>Session Data Inspector</h2>
<p><strong>Environment:</strong> Development Mode</p>
<p><strong>Session ID:</strong> #session.sessionID#</p>
<!--- Display entire session scope --->
<cfdump
var="#session#"
label="Complete Session Scope"
expand="no"
top="5">
<hr>
<!--- Display user information only --->
<h3>User Session Data</h3>
<cfdump
var="#session.user#"
label="User Information"
expand="yes">
<hr>
<!--- Display shopping cart with sensitive data hidden --->
<h3>Shopping Cart Contents</h3>
<cfdump
var="#session.shoppingCart#"
label="Cart Debug"
expand="yes"
hide="cartID">
<hr>
<!--- Show only specific user fields --->
<h3>Authentication Status</h3>
<cfdump
var="#session.user#"
label="Auth Info"
show="userID,isAuthenticated,loginTime,lastActivity">
<!--- Log session data to file for persistent debugging --->
<cfif isDefined("url.logSession")>
<cfset debugFileName = "session-debug-" & session.user.userID & "-" & dateFormat(now(), "yyyymmdd-HHMMSS") & ".html">
<cfdump
var="#session#"
output="#getTempDirectory()##debugFileName#"
format="html"
label="Session Debug Log - User #session.user.userID#">
<p style="color: green;">Session data logged to: #getTempDirectory()##debugFileName#</p>
</cfif>
<cfelse>
<!--- Production environment - don't expose session data --->
<h2>Session Debugging Disabled</h2>
<p>Session debugging is only available in development environments for security reasons.</p>
</cfif>
<!--- Display session statistics without sensitive data --->
<cfscript>
sessionInfo = {
"sessionExists": structKeyExists(session, "user"),
"isLoggedIn": structKeyExists(session, "user") AND session.user.isAuthenticated,
"cartItemCount": structKeyExists(session, "shoppingCart") ? arrayLen(session.shoppingCart.items) : 0,
"sessionAge": structKeyExists(session, "user") ? dateDiff("n", session.user.loginTime, now()) & " minutes" : "N/A"
};
</cfscript>
<h3>Session Summary (Safe for all environments)</h3>
<cfdump var="#sessionInfo#" label="Session Stats">
File upload validation and debugging
Your company's document management system allows users to upload various file types (PDFs, images, Word documents). Recently, users have reported upload failures and file corruption. Some uploads succeed but the files aren't accessible. You need to debug the file upload process and validate that files are being processed correctly.
Problem statement
- File uploads failing without clear error messages
- Need to verify file metadata and properties
- Must validate file size, type, and content
- Unclear what data is captured during upload
- File object structure is not well understood
- Need to log upload details for troubleshooting
Solution
Use cfdump to inspect file upload objects and cffile operation results.
<!--- Create a simple upload form --->
<cfif NOT isDefined("form.fileUpload")>
<h2>File Upload Debugger</h2>
<p>Upload a file to see detailed information about the upload process.</p>
<form method="post" enctype="multipart/form-data">
<div style="margin: 20px 0;">
<label for="fileUpload">Select a file to upload:</label><br>
<input type="file" name="fileUpload" id="fileUpload" required>
</div>
<div>
<button type="submit">Upload and Analyze</button>
</div>
</form>
<!--- Show request information for debugging upload issues --->
<h3>Current Request Information</h3>
<cfscript>
requestInfo = {
"templatePath": getCurrentTemplatePath(),
"requestMethod": isDefined("form") ? "POST" : "GET",
"formSubmitted": structKeyExists(form, "fileUpload")
};
</cfscript>
<cfdump
var="#requestInfo#"
label="Request Information"
expand="yes">
<cfelse>
<!--- File was uploaded, process and analyze it --->
<h2>File Upload Analysis</h2>
<cfscript>
// Define upload directory (use temp directory for demo)
uploadDir = getTempDirectory() & "uploads/";
// Create directory if it doesn't exist
if (!directoryExists(uploadDir)) {
directoryCreate(uploadDir);
}
</cfscript>
<!--- Perform the file upload --->
<cftry>
<cffile
action="upload"
fileField="fileUpload"
destination="#uploadDir#"
nameConflict="makeunique"
result="uploadResult">
<h3>✓ Upload Successful</h3>
<!--- Display complete upload result --->
<cfdump
var="#uploadResult#"
label="File Upload Result Object"
expand="yes">
<hr>
<!--- Get additional file information --->
<cfscript>
uploadedFilePath = uploadResult.serverDirectory & "/" & uploadResult.serverFile;
fileInfo = getFileInfo(uploadedFilePath);
</cfscript>
<!--- Display detailed file information --->
<h3>Extended File Information</h3>
<cfdump
var="#fileInfo#"
label="File System Details"
expand="yes">
<hr>
<!--- Create a summary object with key information --->
<cfscript>
uploadSummary = {
"originalFileName": uploadResult.clientFile,
"serverFileName": uploadResult.serverFile,
"fileSize": numberFormat(uploadResult.fileSize) & " bytes (" & numberFormat(uploadResult.fileSize / 1024, "0.00") & " KB)",
"mimeType": uploadResult.contentType & "/" & uploadResult.contentSubType,
"fileExtension": uploadResult.serverFileExt,
"uploadStatus": uploadResult.fileWasSaved ? "Saved Successfully" : "Upload Failed",
"serverPath": uploadResult.serverDirectory,
"uploadedAt": now(),
"fileExists": fileExists(uploadedFilePath)
};
</cfscript>
<h3>Upload Summary (User-Friendly View)</h3>
<cfdump
var="#uploadSummary#"
label="Quick Summary"
expand="yes">
<hr>
<!--- Display only the most important fields --->
<h3>Key Upload Details</h3>
<cfdump
var="#uploadResult#"
label="Essential Info"
show="clientFile,serverFile,fileSize,contentType,fileWasSaved"
expand="yes">
<!--- Log upload details to file --->
<cfif isDefined("url.logUpload")>
<cfset logFileName = "upload-log-" & dateFormat(now(), "yyyymmdd-HHMMSS") & ".html">
<cfdump
var="#uploadResult#"
output="#getTempDirectory()##logFileName#"
format="html"
label="File Upload Log - #uploadResult.clientFile#">
<p style="color: green;">Upload details logged to: #getTempDirectory()##logFileName#</p>
</cfif>
<!--- Validation example --->
<cfscript>
validationResults = {
"isValidSize": uploadResult.fileSize <= 5000000, // 5MB limit
"isValidType": listFindNoCase("jpg,jpeg,png,gif,pdf,doc,docx", uploadResult.serverFileExt),
"fileWasSaved": uploadResult.fileWasSaved,
"securityCheck": uploadResult.fileSize > 0
};
allValid = true;
for (key in validationResults) {
if (!validationResults[key]) {
allValid = false;
break;
}
}
</cfscript>
<h3>Validation Results</h3>
<cfdump
var="#validationResults#"
label="File Validation"
expand="yes">
<cfif allValid>
<p style="color: green; font-weight: bold;">✓ All validation checks passed!</p>
<cfelse>
<p style="color: red; font-weight: bold;">✗ Some validation checks failed!</p>
</cfif>
<p><a href="?">Upload Another File</a></p>
<cfcatch type="any">
<!--- Display error information --->
<h3 style="color: red;">✗ Upload Failed</h3>
<cfdump
var="#cfcatch#"
label="Error Details"
expand="yes"
show="message,detail,type,tagContext">
<p><a href="?">Try Again</a></p>
</cfcatch>
</cftry>
</cfif>
<!--- Display form data if available (useful for multi-part forms) --->
<cfif structKeyExists(form, "fileUpload") AND structCount(form) GT 1>
<h3>Additional Form Data</h3>
<cfdump
var="#form#"
label="Form Scope"
hide="fileUpload"
expand="yes">
</cfif>