MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference page 403

Cfml language reference
Table of Contents

Advertisement

Chapter 2: ColdFusion Functions
For example, "LocalVar" is undefined, however, the following logic functions as you
would expect if you do not use pound signs around "LocalVal":
<CFOUTPUT>
#IIf(IsDefined("LocalVar"), "LocalVar", DE("The variable is not
defined."))#
</CFOUTPUT>
The output is:
The variable is not defined.
Whereas, the pound signs around "LocalVar" in the following code cause it to fail with
the error message 'Error Resolving Parameter', because ColdFusion never has a chance
to evaluate the original condition
<CFOUTPUT>
#IIf(IsDefined("LocalVar"), DE("#LocalVar#"), DE("The variable is not
defined."))#
</CFOUTPUT>
The error message would be:
Error resolving parameter LOCALVAR
The DE function has no impact on the evaluation of LocalVal, since the pound signs
cause it to be evaluated immediately.
Examples
<!--- This example shows IIf --->
<HTML>
<HEAD>
<TITLE>
IIf Example
</TITLE>
</HEAD>
<BODY bgcolor=silver>
<H3>IIf Function</H3>
<P>IIf evaluates a condition, then
string expression 1 or string expression 2 depending on the
Boolean outcome <I>(TRUE = run expression 1; FALSE = run
expression 2)</I>.
</P>
<P>The result of the expression
IIf( Hour(Now()) GT 12,
DE("It is afternoon or evening"),
DE("It is morning"))
is:<BR>
<CFOUTPUT>
#IIf( Hour(Now()) GT 12,
DE("It is afternoon or evening"),
error 'Error Resolving Parameter' if there is an undefined variable in
string_expression1.
IsDefined("LocalVar")
performs an Evaluate on
.
379

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents