Hey Mark.
Thanks for the len() suggestion - totally forgot about that!
Karl
> From: "Marc Campeau" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Thu, 23 May 2002 12:04:50 -0400
> To: <[EMAIL PROTECTED]>
> Subject: RE: [CFTALKTor] iif error
>
>> #iif(IsDefined("myCClist") AND myCClist IS NOT "",
>> DE("cc=""#myCClist#"""),
>> DE(""))#
>
> Some have suggested that the AND in your IIF condition clause is what causes
> this problem and is probably true if you are using CFServer 4 or earlier. I
> don't remind when Allaire fixed this but I know that CFServer 4.5.2 allows
> you to do IsDefined("x") AND x EQ whatever because if isDefined() returns
> false then the remaining tests in the condition don't get evaluated because
> it becomes the result will automatically yield false. My guess would be that
> it is the DE("#myVar#") within the IIF that is causing the error.
>
> IIF does an evaluate for it's returned data, by using DE() you are
> preventing the evaluation from happening. But then in that DE() you are
> asking CF to evaluate the variable myCClist. The way CFServer processes
> this, that's from my own experience (please correct me if I'm wrong) is that
> CFServer will first convert the content of the DE() into a constant before
> evaluating the whole IIF statement, which in turns yields an error if
> myCClist is not defined.
>
> Since you're using a CFMAIL you probably don't want some white spaces and
> that's probably why you chose to use IIF rather than CFIF.
>
> I would suggest you do this:
>
> Put this outside the CFMAIL tag
> <CFPARAM NAME="VARIABLES.myCClist" DEFAULT="" TYPE="string">
>
> replace your IIF with:
> #iif( len(myCClist) GT 0, DE("cc="), DE(""))##myCClist#
>
> This will give you the result you expected. Also, when comparing a String to
> the empty string Macromedia suggests that using len() is faster than the
> "IS" or "EQ" operator.
>
> Hope this helps,
>
> Marc Campeau
>
> -
> You are subscribed to the CFUGToronto CFTALK ListSRV.
> This message has been posted by: "Marc Campeau" <[EMAIL PROTECTED]>
> To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
> Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
> This System has been donated by Infopreneur, Inc.
> (http://www.infopreneur.net)
-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "A. Karl Zarudny" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)