you don't need the de() call around the variable name, just put it in quotes:
iif(structKeyExists(struct, "keyname"), "struct.keyname", de("no key")) Your code was trying to output a variable with a name equal to the value stored in #struct.keyname#, which isn't what you wanted. Usually, using CFIF is more readable (especially with complex expressions) and it's always faster, as it doesn't require any delayed evaluation (which is slow). Sometimes it's the only way to get a job done, but you generally shouldn't use it unless you have to. barneyb --- Barney Boisvert, Senior Development Engineer AudienceCentral (formerly PIER System, Inc.) [EMAIL PROTECTED] voice : 360.756.8080 x12 fax : 360.647.5351 www.audiencecentral.com > -----Original Message----- > From: Alexander Sherwood [mailto:[EMAIL PROTECTED] > Sent: Friday, April 04, 2003 11:36 AM > To: CF-Talk > Subject: IIF() and IsDefined() > > > Help: > > #IIF(StructKeyExists(struct, 'keyname'),DE(struct.keyname),DE('no > key'))# .........fails if the key is not present. > > BUT, > > <cfif StructKeyExists(struct, 'keyname')> > #struct.keyname# > <cfelse> > no key > </cfif> > > doesn't. > > Am I missing something about IIF() and DE()? It looks as if both DE() > expressions must be "evaluateable", and the IIF() just decides > which one to > evaluate? Correct? > > Thanks, > > ---------------------------------- > Alex Sherwood > PHS Collection Agency > THE COLLECTORS > T: 301.215.4200 > F: 301.664.6834 > W: www.phs-net.com > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4