> > > <cfset variables.nickname = Iif( (arguments.nicknameInd NEQ 0) AND
> > > (IsDefined("importData.nickname")),
> > > De(importData.Nickname), De(""))>
> >
> > CF is going to verify that the variable exists, because you're referring to 
> > it.
> >
> > That's what's happening here. Just because you're using the DE() function 
> > doesn't
> > mean that CF isn't going to evaluate importData.nickname at runtime
> > to verify that there's actually something called importData.nickname in 
> > case it needs
> > to reference that value.
>
> Thanks for the reply.  My misuse of terminology aside, that would mean that 
> the
> following cannot be converted to using IIF():
>
>         <cfif IsDefined("importData.nickname")>
>                 <cfset variables.nickname = importData.nickname>
>         <cfelse>
>                 <cfset variables.nickname = "">
>         </cfif>
>
> I thought the whole point of the DE() function was to delay evaluation of its 
> argument
> until it was actually needed (e.g., when the IIF() function's first argument 
> evaluates to
> true).  If not, then the only way to use a variable, that may not be defined, 
> is by way of
> the full <cfif> treatment.  Is that right?

No, that's not entirely right. But the CFIF is more readable, so you
might want to go with that anyway. Honestly, I find IIF to be hard to
read a lot of the time, so I try to avoid it.

Now that you have a corresponding CFIF, it's a bit clearer to me what
you're trying to do. Here's how you'd do that, I think, in IIF:

<cfset variables.nickname = iif(arguments.nicknameInd neq 0 and
isDefined("importData.nickname"), "importData.nickname", "")>

(note, I haven't tested this because I'm not in my office)

The IIF function will automatically evaluate the last two arguments
and return their values, but you'll notice that the arguments
themselves are strings. Your second argument doesn't actually refer to
the variable until that branch is executed. Does that make sense?

Dave Watts, CTO, Fig Leaf Software
1-202-527-9569
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Service-Disabled Veteran-Owned Small Business
(SDVOSB) on GSA Schedule, and provides the highest caliber vendor-
authorized instruction at our training centers, online, or onsite.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360050
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to