MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 95

Developing coldfusion mx applications
Table of Contents

Advertisement

Function
Purpose
IIf
Evaluates a boolean condition expression. Depending on whether this
expression is True or False, dynamically evaluates one of two string expressions
and returns the result of the evaluation. The
incorporating a
For an example of using this function, see
Sets a variable identified by the first argument to the value specified by the
SetVariable
second argument. This function is no longer required in well-formed ColdFusion
pages; see
Function argument evaluation considerations
It is important to remember that ColdFusion always evaluates function arguments before the
argument values are passed to a function:
For example, consider the following
<cfoutput>#DE("1" & "2")#</cfoutput>
You might expect this line to display """1"" & ""2""". Instead, it displays "12", because
ColdFusion processes the line as follows:
Evaluates the expression "1" & "2" as the string "12".
1
Passes the string "12" (without the quotes) to the
2
Calls the
function, which adds literal quotation marks around the 12.
3
DE
Similarly, if you use the expression DE(1 + 2), ColdFusion evaluates 1 + 2 as the integer 3 and
passes it to the function. The function converts it to a string and surrounds the string in literal
quotation marks: "3".
About the Evaluate function
The
function takes one or more string expressions, dynamically evaluates their contents
Evaluate
as expressions from left to right, and returns the result of evaluating the rightmost argument.
The following example shows the
processing:
<cfset myVar2="myVar">
<cfset myVar="27/9">
<cfoutput>
#myVar2#<br>
#myVar#<br>
#Evaluate("myVar2")#<br>
#Evaluate("myVar")#<br>
#Evaluate(myVar2)#<br>
#Evaluate(myVar)#<br>
</cfoutput>
cfif
tag in-line in HTML.
"SetVariable function considerations" on page
function:
DE
function and how it works with ColdFusion variable
Evaluate
Dynamic expressions and dynamic variables
function is convenient for
IIF
"Using the IIF function" on page
function.
DE
98.
97.
95

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents