User Guide

458 Chapter 3: ColdFusion Functions
DE
Description
Postpones evaluation of a string as an expression, when it is passed as a parameter to the IIf or
Evaluate functions. Escapes any double quotation marks in the parameter and wraps the result
in double quotation marks.
This function is especially useful with the
IIf function, to prevent the function from evaluating a
string that is to be output.
This applies to expressions that are not surrounded by pound signs. (If pound signs surround any
part of an expression, a ColdFusion function evaluates that part first, regardless of whether the
DE
function is present.)
Returns
Parameter, surrounded by double quotation marks, with any inner double quotation marks
escaped.
Category
Dynamic evaluation functions
Function syntax
DE(string)
See also
Evaluate, IIf
Parameters
Usage
Consider this example:
<condition> <true expression> <false expression>
IIf( 1 eq 2, DE('#Var1#'), DE('#Var2#'))
ColdFusion evaluates whatever is surrounded by pounds in the expression before executing it. So,
although this expression is never true (because
Var1 does not exist), the expression fails with an
'Error Resolving Parameter' error, because ColdFusion evaluates #Var1#' and #Var2#' before
executing either expression.
This example returns 'Var2':
IIf( 1 eq 2, DE('Var1'), DE('Var2'))
The following example uses IIF to alternate table-row background colors, white and gray. It uses
the
DE function to prevent ColdFusion from evaluating the color strings.
<cfoutput>
<table border="1" cellpadding="3">
<cfloop index="i" from="1" to="10">
<tr bgcolor="#IIF( i mod 2 eq 0, DE("white"), DE("gray") )#">
<td>
hello #i#
</td>
Parameter Description
string String to evaluate, after delay