In CF 7, the function IIF (inline IF) usage is:-

     IIf(condition, string_expression1, string_expression2)

which I initially interpreted to be the equivalent of:-

     <cfif condition>
          <cfset result = string_expression1>
     <cfelse>
          <cfset result = string_expression2>
     </cfif>

but when I do:-

     #IIF(condition,"[a]","")#

I get an error.

On closer inspection, it turns out that IIF is really the equivalent of:-

     <cfif condition>
          <cfset result = Evaluate(string_expression1)>
     <cfelse>
          <cfset result = Evaluate(string_expression2)>
     </cfif>

I've been interpreting 'string_expression' to mean an expression that
returns a string, but really means a string (or string variable) that
contains an expression.

Why is this? How do I do in-line case/switch expression?


Chris
--
Chris Velevitch
Manager - Adobe Platform Users Group, Sydney
m: 0415 469 095
www.apugs.org.au

Adobe Platform Users Group, Sydney
September 2010:  The "State of CFML" Address
Date: 27th September, 6pm for 6:30 start
Details and RSVP coming.

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to