Ok, it's not a problem as such, just the way functions work... before IIF 
can be run (before any function can be run) all the arguments must be 
resolved, the second argument in your example may not be resolved because 
FORM.classCodeID may not exist.  The correct way to write this...

#IIF(IsDefined("FORM.classCodeID"), 'FORM.classCodeID', DE("ALL"))#

note we are supplying a string expression as the second argument, and the 
third argument is a delayed evaluation of a string expression, if we didn't 
wrap DE around the "ALL" then if IIF came to evaluate that expression it 
would try to evaluate the varibale ALL, wrapping DE around it causes it to 
evaluate the string "ALL".

At 10:20 AM 11/1/2001, you wrote:
>why is it when you use IIF() and you are checking to see if a variable
>exists, the process will error out?  here is an example:
>
>#IIF(IsDefined("FORM.classCodeID"), DE(FORM.classCodeID), DE("ALL"))#
>
>if FORM.classCodeID exists, the code works fine.  but if FORM.classCodeID
>doesn't exist, it errors saying it can't find FORM.classCodeID.  shouldn't
>it run the second DE() statement?  am i just not understanding the whole
>IIF() tag?  has anyone else run into this and is there anyway of making it
>work without using <CFIF> tags?
>
>jason
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to