Description

A function equivalent to the <cfdump> tag which can be used in <cfscript>.

Parameters

Same as <cfdump> tag.

Category

Other functionsData output functions

Function syntax

WriteDump (var, output, format, abort, label, metainfo, top, show, hide, keys, expand, showUDFs);

See also

cfdumpcfscript

History

ColdFusion 11: Parameters passed to this function needs to be in a comma-separated format.

ColdFusion 9: Added this function.

Usage

You can call this function providing arguments as name-value pair or as positional arguments.For positional notations, the sequence must be followed exactly in the same manner as provided in the syntax. If you do not provide one of the parameters, use an empty string instead. This does not apply to Boolean values for which you must provide proper values even if you have to skip them.

Example 1

 

<cfscript>
    myArr=listToArray("The,Quick,Brown,Fox,Jumps,Over,The,Lazy,Dog")
    writeDump(var="#myArr#",format="text")
</cfscript>

Output

array

1) The
2) Quick
3) Brown
4) Fox
5) Jumps
6) Over
7) The
8) Lazy
9) Dog

Example 2

 

<cfscript>
    myArr=listToArray("The,Quick,Brown,Fox,Jumps,Over,The,Lazy,Dog")
    writeDump(var="#myArr#",output="browser",format="text",label="WriteDump example")
</cfscript>

Output

WriteDump example - array

1) The
2) Quick
3) Brown
4) Fox
5) Jumps
6) Over
7) The
8) Lazy
9) Dog

Example 3

 

<cfscript> 
	filename = "log.txt"; 
	try { 
		result = FileOpen(expandpath(filename)); 
		WriteDump(result); 
	} 
	catch(Expression exception) { 
	WriteOutput("<p>An Expression exception was thrown.</p>"); 
	WriteOutput("<p>#exception.message#</p>"); 
	WriteLog(type="Error", file="myapp.log", text="[exception.type] #exception.message#"); 
	} 
</cfscript>

Output

An Expression exception was thrown.

File or directory /shared/cffiddle/cffiddle/c85fa036-5a93-423a-b748-4f0852e91d64/b0faac60-e774-4e5c-aff0-ce794e966d29/log.txt does not exist.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy