![MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference Download Page 403](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-cfml-language/coldfusion-4-5-cfml-language_reference_3287257403.webp)
Chapter 2: ColdFusion Functions
379
error ’Error Resolving Parameter’ if there is an undefined variable in
string_expression1.
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
IsDefined(“LocalVar”)
.
<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 performs an Evaluate on
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"),
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...